Fix flatpickr random error

This commit is contained in:
Andrew Kingston 2022-11-17 10:16:27 +00:00
parent 102d6084f1
commit 43fb581fde
1 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,15 @@
let open = false
let flatpickr, flatpickrOptions
// Another classic flatpickr issue. Errors were randomly being thrown due to
// flatpickr internal code. Making sure that "destroy" is a valid function
// fixes it. The sooner we remove flatpickr the better.
$: {
if (flatpickr && !flatpickr.destroy) {
flatpickr.destroy = () => {}
}
}
const resolveTimeStamp = timestamp => {
let maskedDate = new Date(`0-${timestamp}`)