Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blur event not setting date correctly when allowInput true #2394

Closed
growpathjadamson opened this issue Jan 21, 2021 · 1 comment · Fixed by #2419
Closed

Blur event not setting date correctly when allowInput true #2394

growpathjadamson opened this issue Jan 21, 2021 · 1 comment · Fixed by #2419

Comments

@growpathjadamson
Copy link

growpathjadamson commented Jan 21, 2021

When using the allowInput functionality alongside the enableTime flag, inputting dates directly no longer works. To reproduce:

  • go to the fiddle
  • select a date/time
  • close the picker
  • click on the input again
  • type in a new date
  • click another part of the page
  • The picker will revert back to the previous value

When using enableTime: false, clicking on another part of the page would keep the newly input date.

Oddly, if you press enter or tab instead of just clicking out of the calendar, the Date is updated correctly. Did some digging to see what kind of issue it might be, and I think it may have to do with the blur event triggering twice, the first time setting the input field to what's currently selected in the picker widget and the second time it updates the internal date based on the input value (which is now whatever was selected in the picker). No idea why this only becomes a problem when using date+time.

https://jsfiddle.net/dv2qbeyp/

Your Environment

  • flatpickr version used: master
  • Browser name and version: Google Chrome (87.0.4280.141)
  • OS and version: macOS Big Sur (11.1)
@Sayan751
Copy link

@chmln Submitted a PR to fix this. Can you please review that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants