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
The OnBlur event fired by the @progress/kendo-react-dateinput DatePicker component passes an OnBlur event. This OnBlur event contains a value which represents the formatted text value of the inputbox, not the Date value of the input. The OnChange event passes a Date object as the value. This discrepancy caused an issue with a form handling library react-hook-form as it reads the value from OnBlur and saves it too, then passes it back to DatePicker which fails the proptype check as a String is not a Date.
Expected behavior
I would expect the Value types to be the same on both OnChange and OnBlur
Minimal reproduction of the problem with instructions
I also opened react-hook-form/react-hook-form#854 in the react-hook-form repo as the fact that they read the values from the OnBlur also seems strange.
The picker is composite component and you will get the blur many times when changing in between the calendar and the input and also gives you the native blur event of the elements from inside it.
You can wrap the picker, store the value using onChange, and use the last stored value in your blur handler if this is needed.
We are not going to add wrapped blur callback with value, since it will be async, and can lead to further problems.
I'm submitting a...
Current behavior
The
OnBlur
event fired by the @progress/kendo-react-dateinput DatePicker component passes an OnBlur event. This OnBlur event contains a value which represents the formatted text value of the inputbox, not theDate
value of the input. TheOnChange
event passes aDate
object as the value. This discrepancy caused an issue with a form handling libraryreact-hook-form
as it reads the value from OnBlur and saves it too, then passes it back to DatePicker which fails the proptype check as a String is not a Date.Expected behavior
I would expect the Value types to be the same on both OnChange and OnBlur
Minimal reproduction of the problem with instructions
Can be seen on this CodeSandbox:
https://codesandbox.io/s/broken-thunder-9f4m3
What is the motivation or use case for changing the behavior?
To have consistency in the OnChange and OnBlur events, and to fix the integration with react-hook-form
Environment
Package versions:
Can be seen in CodeSandbox, latest kendo(3.10.0), react(16.8.4), and react-hook-form(4.5.5)
Browser:
The text was updated successfully, but these errors were encountered: