Handle undefineds
This commit is contained in:
parent
2b1df81649
commit
d97f3b0378
1 changed files with 5 additions and 0 deletions
|
@ -9,6 +9,11 @@
|
||||||
$: displayValue = value?.format("HH:mm")
|
$: displayValue = value?.format("HH:mm")
|
||||||
|
|
||||||
const handleChange = e => {
|
const handleChange = e => {
|
||||||
|
if (!e.target.value) {
|
||||||
|
dispatch("change", undefined)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const [hour, minute] = e.target.value.split(":").map(x => parseInt(x))
|
const [hour, minute] = e.target.value.split(":").map(x => parseInt(x))
|
||||||
dispatch("change", value.hour(hour).minute(minute))
|
dispatch("change", value.hour(hour).minute(minute))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue