You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This applies to datePickerType="single", probably to "range" as well. In this case the change event is fired indirectly via the onChange event of flatpickr.
Steps to reproduce:
Add DatePicker with...
A maxDate multiple years in the past (e.g. 20 years), this can cause a forced clear if a partial date is typed.
dateFormat="Y-m-d"
Add on:change listener that logs dateStr/processes date.
Select a date with the calendar popup.
Clear the value either...
manually via the keyboard (delete everything)
via a forced clear. e.g. reduce 2000-01-31 to just 200 and click/tab away. (If it only gets reduced to something like 2000-, the value gets completed, in this case to 2000-01-01. This fires a change event.)
REPL (Use With max in past for the forced clear case)
This REPL shows one of the use cases for the event: Creating a value input/change event output loop to create a component that has a Date-typed prop. value alone cannot be bound and reactively set at the same time as that would constitute a circular dependency.
Flatpickr has an event onValueUpdate that probably could be considered, as onChange does not appear to fire on clear.
The text was updated successfully, but these errors were encountered:
on:change should fire when the value is manually updated and input blurred
consider using on:input for individual character updates per your suggestion
Not sure what suggestion you are referring to but yes, an input event should fire for individual characters while change should only be fired after the edit was made and it is considered complete (blur + value different from before).
should there be an on:clear event?
Could be helpful for certain use cases (e.g. revert to a better default), if you mean that this should fire if flatpickr causes the clear, but it should coincide with a change event, so not both events have to be handled to cover all changes.
I was thinking about how that could be done and played around with blur and onValueChange to detect change and clear; maybe this is helpful: REPL
This applies to
datePickerType="single"
, probably to"range"
as well. In this case thechange
event is fired indirectly via theonChange
event of flatpickr.Steps to reproduce:
DatePicker
with...maxDate
multiple years in the past (e.g. 20 years), this can cause a forced clear if a partial date is typed.dateFormat="Y-m-d"
on:change
listener that logsdateStr
/processes date.2000-01-31
to just200
and click/tab away. (If it only gets reduced to something like2000-
, the value gets completed, in this case to2000-01-01
. This fires a change event.)REPL (Use
With max in past
for the forced clear case)This REPL shows one of the use cases for the event: Creating a
value
input/change
event output loop to create a component that has aDate
-typed prop.value
alone cannot be bound and reactively set at the same time as that would constitute a circular dependency.Flatpickr has an event
onValueUpdate
that probably could be considered, asonChange
does not appear to fire on clear.The text was updated successfully, but these errors were encountered: