Rudeg / react-input-calendar

http://rudeg.github.io/react-input-calendar/
MIT License
139 stars 94 forks source link

An incorrect date is passed when manually typing date into input element and submitting form #130

Open turpana opened 5 years ago

turpana commented 5 years ago

When manually typing in the date into the input field and immediately pressing on the Enter key to submit the form, an incorrect date is passed to the onChange handler. This does not happen if I click on the submit button or continue editing the form before submitting.

turpana commented 5 years ago

I added a test on my fork which fails, but passes if you uncomment the input.simulate('blur') line:

https://github.com/turpana/react-input-calendar/blob/master/src/tests/index.js#L60

The blur event must be the difference between just pressing Enter or interacting further with the form. Hopefully that makes it a little clearer what the cause of the issue is.