Handle undefineds

This commit is contained in:
Adria Navarro 2024-05-21 11:54:42 +02:00
parent 2b1df81649
commit d97f3b0378
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,11 @@
$: displayValue = value?.format("HH:mm")
const handleChange = e => {
if (!e.target.value) {
dispatch("change", undefined)
return
}
const [hour, minute] = e.target.value.split(":").map(x => parseInt(x))
dispatch("change", value.hour(hour).minute(minute))
}