-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
feat(DateField): improve month segment behavior for invalid months starting with 1 #1560
base: v2
Are you sure you want to change the base?
Conversation
ad0ee78
to
4021da8
Compare
…arting with 1 When typing invalid months starting with 1 (13-19): - Keeps 1 as the month value - Automatically uses the second digit as the initial value for the day segment For example, when typing "13": - "1" remains as the month - Moves to day segment - "3" becomes the initial value of the day
4021da8
to
b29a011
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @acabreragnz,
First of all, thank you for your contribution! 🚀
The feature is very good improvement to the UX, but I have one concern about it, namely if you change the locale
to fr
or any other locale
which uses the dd/mm/yyyy
format, it moves the focus on the year segment and updates the day which would be the desired behaviour.
You could add a check to see which is the next segment and/or maybe expand this functionality for the dd/mm/yyyy
format and yyyy/mm/dd
, the latter being used by locales such as zh
.
This reverts commit def452f.
@epr3 thank you for your feedback! the PR was not ready for review; it was my mistake for not setting it as a draft. Currently, I'm finalizing the same behavior for transitioning from days to years in the Once this is complete, I will polish the code and implement all the changes you requested. |
Changes
Example
When typing "13":
Why
This change improves user experience by making the input behavior more intuitive when users type invalid month numbers. Instead of discarding the first digit, it uses both digits meaningfully - preserving the valid part (1) for the month and using the second digit to pre-fill the day.
Testing