Defining no maxDate defaults to the end of the next year
Context:
- Browser [All]
- Browser-version [All]
- Schedule-X version [All]
Describe the bug
A max date is being set in packages/date-picker/src/utils/stateful/config/config.impl.ts for the date picker. This leads to you being unable to scroll past this date with the back and forward buttons.
To Reproduce
Steps to reproduce the behaviour:
- Go to the hosted example
- Click on the forward chevron button until you get to December 2025
- You will not be able to scroll past December
Expected behaviour
I don't know if this is expected, but the docs need to be adjusted if it is.
Screenshots
This is a regression.
When I started building the project, there was no max date feature, but I didn't want to render more years than 1 year ahead in the date picker year view by default. Then I added a maxDate feature, and seems like I accidentally used the same default date for that, as for the years rendered in the year view.
Thanks for reporting!
@tomosterlund, which way do you want to go with the fix? I would be prepared to PR; I need to know if you want to update the docs or remove the default and then I will start 😄
I’d say the desired behavior is:
- year view in date picker should only display up until current year + 1 OR we start adding more years by default, but scroll to the year of selectedDate when opening the view
- no maxDate in date picker per default
I’ll gladly have a look at any PR here 😊
decided on a slightly different approach:
- keep min- and max dates in date picker, but increase default to current year + 50 (reduced complexity a fair bit compared to allowing an undefined date)
- in v3 introduce breaking change in calendar, where calendar + date picker share a common min- max date per default
awesome thanks so much @tomosterlund