-
-
Notifications
You must be signed in to change notification settings - Fork 739
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
Setting the display month to a value outside of the selectable range causes the DayButton component to not render #2671
Comments
Hi @anthony-bonta-gaf-energy |
I agree that this is an unexpected state of the calendar. Should DayPicker handle this case, or should the developer take care of the values passed in? Should the days be clickable - or should we render the closest available month? |
@rodgobbi the use case for this is as follows:
They can correct it by selecting a year in the range, but it would be nice to show a read-only view of the previous date they selected. This is a data flow issue. When the data comes in, the drop downs correctly reflect the old date, but it doesn't show the day. @gpbl The main concern with trying to auto correct this is that you'll be lying to the user about the value that is actually set. If data is flowing in a single direction, as it should be, the value coming into the calendar is a valid date but needs to be corrected. I want to be transparent with the user about what the current value is and force them to tell me what to update it to. If you show them the latest month, many will get confused and think the currently selected day is not what they originally chose. |
Agree with @anthony-bonta-gaf-energy, better not have any side effects caused by mounting the For me, it's still a valid approach to show the outside days as disabled, need to check @gpbl's thoughts. @anthony-bonta-gaf-energy I have the feeling that just displayeing the day picker all disabled wouldn't be providing enough clarity to the users. The day picker only got to the inconsistent state because the If the valid date range changes when loading the form, and the previous selected date is invalid, this could be considered an invalid input. |
To reproduce
If you’re unable to easily reproduce this bug, consider opening a support thread to discuss it further.
CodeSandbox: https://playcode.io/2231858
Actual Behavior
The table cells render for the month and the actual months in the drop down are correctly disabled. However, the buttons in each cell do not render at all.
Note that you can still work around this by selecting a year in the range.
Expected Behavior
I would expect a set of buttons to be rendered even if they're outside of the range. The use case for this is a range of +-1 year and the user selected a value over a year ago and we want to reflect that in the selection and make them update it.
Screenshots
The text was updated successfully, but these errors were encountered: