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
[x] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe
Tell about your platform
Vue.js version : 2.4.2
Browser name and version : Chrome Version 60.0.3112.113 (Official Build) (64-bit) on Ubuntu
This package version : 4.0.0
Current behavior
I'm passing a :config object to my flat-pickr instance. Whenever I update that object (to update the minDate option for example), the @input event of the flat-pickr instance is fired.
Expected behavior
I would expect the @input to only fire when the actual value of the input change, not when it's config change.
Minimal reproduction of the problem with instructions
To give more context, I'm trying to build a form with two flat-pickr selectors. One for the "start date" and one for the "end date". I'd like to update the minDate option of the second instance to be the value of the first instance. In other words, I'd like to make sure it's not possible to pick an end date that is before the start date.
In the first instance @input, I'm changing the second instance config, but this also fires the second instance @input.
You can see the issue in action here: https://jsfiddle.net/2dLr1t1t/2/
Try to use the Foo date picker, and it will trigger the @input on the Bar datepicker as well. What is surprising is that it seems to only do it once (other updates of Foo won't update Bar).
The text was updated successfully, but these errors were encountered:
You are updating config of second input when first input value gets changed . Each component watches for any change in config, apply them and tell date picker to redraw itself.
To ensure that everything is ok ; I also sets the current date. This is where input event gets emitted.
This is being discussed in issue #20 already.
Thanks for the explanation, I understand why it behaves that way. A change in the config actually fires a change in the value itself.
From a user POV I find it surprising, but from a developer POV I see why it behaves that way. That being said, the event being called input, one could argue that is should only react to actual change to the input value, not its config.
As a workaround I'm checking the new value passed to the event. In the case of an update in the config, the value is actually empty and I can silently ignore the event. I can live with this workaround :)
I'm submitting a ... (check one with "x")
Tell about your platform
Current behavior
I'm passing a
:config
object to myflat-pickr
instance. Whenever I update that object (to update theminDate
option for example), the@input
event of theflat-pickr
instance is fired.Expected behavior
I would expect the
@input
to only fire when the actual value of the input change, not when it's config change.Minimal reproduction of the problem with instructions
To give more context, I'm trying to build a form with two flat-pickr selectors. One for the "start date" and one for the "end date". I'd like to update the
minDate
option of the second instance to be the value of the first instance. In other words, I'd like to make sure it's not possible to pick an end date that is before the start date.In the first instance
@input
, I'm changing the second instance config, but this also fires the second instance@input
.You can see the issue in action here: https://jsfiddle.net/2dLr1t1t/2/
Try to use the
Foo
date picker, and it will trigger the@input
on theBar
datepicker as well. What is surprising is that it seems to only do it once (other updates ofFoo
won't updateBar
).The text was updated successfully, but these errors were encountered: