-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[DatePicker]: autocorrection of dates is inconsistent and provides no controls over its value #8854
Comments
Seems like this behavior is the default behavior by Flatpickr, which would add another reason to look into alternative external date picker libraries. I'm able to improve it slightly by using the parseDate: (datestr) => {
return new Date(datestr);
}, Related Flatpickr issue: flatpickr/flatpickr#1551 |
+1 for this to be changed. The user may not be aware their invalid input was autocorrected and submit a valid but incorrect date. The user hitting a validation would be preferable in this case so they can be aware of the issue and correct it. For example if you type For conversation sake, an alternative way to approach this if keeping autocorrection is valuable, could be to consider that if the user enters an impossible month or day, assume the character that made it impossible is part of the next part fo the date e.g. given a date format of month/day/year, if the user types |
Hi @tw15egan. Are there any updates on this issue? Thanks in advance! |
Bump for update 👋 |
@joshblack any updates on this issue? It is affecting all date pickers in the Maximo Application Suite |
Hi, any updates on this issue? It would be great to get this fixed. |
In catching up on this my understanding is that it's so far been blocked by flatpickr - the only remedy would've been reimplementing the entire component or refactoring to use a different date picker library. That's a large hunk of work and likely (assuming) why this hasn't been addressed. I found this that is related, #3832 Good news though maybe - in looking at the flatpickr issue, there might be some way to address this now through the |
Related: #8454 (comment) |
So far we've been unable to upgrade flatpickr due to hitting numerous roadblocks. Upgrading caused more bugs than it fixed which even further calls into question the usage of flatpickr. We're considering next steps in #11967. |
Possibly fixed by #15918 |
@davidicus @tay1orjones @sstrubberg It looks like this is now fixed. I tested the variants of the |
What package(s) are you using?
carbon-components
carbon-components-react
Detailed description
When entering a value into the date picker that is not a valid date and then tabbing focus away from the input the incorrect date is replaced with another properly formatted but widely different and probably incorrect date.
Examples:
Typing in
33
will result in a date of09/01/2031
Typing in
99/9
will result in a date of03/09/2061
Additionally, this behavior is inconsistent. If you look at this first "range" story and type
33
into first input then tab to the second and do the same and then tab out of the second input you will see that the first one was replaced while the second one was not.The "simple" story also seems to leave the date as entered.
This issue is related to the
DatePicker
component.I would expect either the value to be left alone and my own validation can handle the error state or there to be a prop that allows me to enter in a default date that can work instead. Ideally it would be for this to be opt in and applications can handle their own error handling.
This issue appears in both latest Chrome and FF
This is the latest Carbon that is published to storybook.
v7.36.0
This question was raised to AI Applications PAL repo
Steps to reproduce the issue
33
into first input and tab to second33
into second input and tab away09/01/2031
and the second input leaves the number as was entered by user.Additional information
The text was updated successfully, but these errors were encountered: