-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[CalendarPicker] Should limit to target year when looking for the closest enabled date on year change #4834
Comments
@alexfauquette for both the year and the month switch, what do you think should be the behavior when all days in month / year are disabled but the month / year was not disabled. Right now we fallback to |
I am not proposing that, because it would mean calling
OK but which day are you selecting when the user clicks on the month ? |
I thought that's already what is done when looking for the closest day
I do not have this part of the codebase in mind, so it might be not feasible, but do we need to select a date? I would consider that if no date is available it is like when clicking on next/prev month, It only modifies the view, but does not change the value |
I think we are not talking about the same thing. When you are on the If the user does We could call I think we have to rely on the fact the the users provided a Right now we have a dirty escape gate because when looking for the closest non-disable date, we allow to leave to selected year. Which can create odd situation. With this current behavior, when disabling all the year day by day, we will end up in a day of another year. We could see as you say if it's possible to not selected a date at all (probably keep the old one). Everything explained above also applies to month selection. |
Fixed by #4814 |
Duplicates
Latest version
Current behavior 😯
When switching to a new year, the component checks if the new date is disabled, and if so tries to find the closest non-disabled date.
But it does it just like when the prop date is disabled, by checking the day before and after, then 2 days before and after, etc...
So it can quickly select a date outside of the current year.
In #4814 I implemented the correct behavior for the months.
For the year, I need dmtrKovalenko/date-io#614
Expected behavior 🤔
Should go to the closest date but remaining in the year requested.
Steps to reproduce 🕹
=> It selects the 31st of December 2023 instead of the 1st of April 2024
The text was updated successfully, but these errors were encountered: