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
Having a controlled DateTime with a value prop spams the console log with warning messages as the user types into the input field.
Expected Results
Do not spam warning messages. Instead there should be a single warning once the user is finished typing a date out. It should be expected the the first character, or first couple of characters, in a date string would not be a valid date. So if the user types "12/12/2023", I should not see a warning message for every character until the user is finished the entire date and has left the input with an onBlur event .
Actual Results
You see this being spammed in the console log after every character change as the user types.
Minimal Reproduction of the Problem
Go to the sandbox, type into the date field and watch the console logs.
Other Information (e.g. stacktraces, related issues, suggestions how to fix)
Looks to be caused by the setViewDate function being called every time a user types in the input. This means it getting called with invalid dates since the user has not finished typing.
Maybe instead only fire this function once the user blurs the input or add some debouncing to the input to prevent warning messages that are not helpful.
The text was updated successfully, but these errors were encountered:
I'm Submitting a ...
Steps to Reproduce
Having a controlled DateTime with a value prop spams the console log with warning messages as the user types into the input field.
Expected Results
Do not spam warning messages. Instead there should be a single warning once the user is finished typing a date out. It should be expected the the first character, or first couple of characters, in a date string would not be a valid date. So if the user types "12/12/2023", I should not see a warning message for every character until the user is finished the entire date and has left the input with an onBlur event .
Actual Results
You see this being spammed in the console log after every character change as the user types.
Minimal Reproduction of the Problem
Go to the sandbox, type into the date field and watch the console logs.
https://codesandbox.io/s/react-datetime-invalid-date-warning-sp7fvt
Other Information (e.g. stacktraces, related issues, suggestions how to fix)
Looks to be caused by the setViewDate function being called every time a user types in the input. This means it getting called with invalid dates since the user has not finished typing.
Maybe instead only fire this function once the user blurs the input or add some debouncing to the input to prevent warning messages that are not helpful.
The text was updated successfully, but these errors were encountered: