-
Notifications
You must be signed in to change notification settings - Fork 543
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
BUG: Patient form is accepting wrong dates in date field #10361
Comments
@bodhish @rithviknishad If it gets approved, please assign it to me. |
@rithviknishad I think it is a state management issue as when I am continuously changing values, it is showing anonymous behavior. Sometimes the wrong value is getting replaced by the random values between 1-31 for days and 1-12 for months. There may be some other issue also which I am missing. I am working on it. |
date-field is expecting user to type in 2 digit values for month (handleMonthChange doesn't change anything if there's only one digit). To fix this, you can modify the logic in handleMonthChange to pad newMonth before the conditional checks. Also given that form doesn't allow submission when month > 12 (barring the padding issue above), I don't think any additional error handling is needed. Edit: handleMonthChange is also the reason why you are able to submit the form after going back and entering 122 in the month column (month isn't changed within form value, instead submitted with previous value). Edit: The auto focus to next cell causes an issue here, hmm let me see. |
I have also tried onFocus and onInput event handlers to clear the values but it is not working. |
You pad the field with an onBlur handler (do the same for day as well) and remove the focus behavior in handleDayChange and handleMonthChange.
|
Describe the bug
We can write any value(decimal, >12) manually in months box of DOB (Date of Birth).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When user type wrong values manually in DOB, it show show error message. Although it is creating patient with default month (december) when wrong value is entered, but it should show proper error message.
Screenshots
InShot_20250202_111116534.mp4
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: