fix: only pass date to flatpickr if it's a valid date
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Resolves #2384
This commit is contained in:
parent
5ffb13a3a8
commit
ede5cdd8cf
|
@ -118,7 +118,13 @@ watch(
|
||||||
newValue => {
|
newValue => {
|
||||||
from.value = newValue.dateFrom
|
from.value = newValue.dateFrom
|
||||||
to.value = newValue.dateTo
|
to.value = newValue.dateTo
|
||||||
flatpickrRange.value = `${from.value} to ${to.value}`
|
// Only set the date back to flatpickr when it's an actual date.
|
||||||
|
// Otherwise flatpickr runs in an endless loop and slows down the browser.
|
||||||
|
const dateFrom = new Date(from.value)
|
||||||
|
const dateTo = new Date(to.value)
|
||||||
|
if (dateTo.getTime() === dateTo.getTime() && dateFrom.getTime() === dateFrom.getTime()) {
|
||||||
|
flatpickrRange.value = `${from.value} to ${to.value}`
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Reference in New Issue