Datepicker older year selection inputbox making empty. no option to disable older years
muruganG opened this issue · 5 comments
Describe the bug
There is two observation found on related to latest clarity 5 datepicker
1.older year disable option not there.
2. when i select older years with date combination ,input box going empty. not changed the value of previous value.
How to reproduce
i have shared the step screens you able to reproduce the you documentation datepicker sample also.
Steps to reproduce the behavior:
- Go to the clarity 5 documentation datepicker sample try to change the year 950 and try to change the date , when you select the date input box its not showing the date.
Expected behavior
Is there any option we can disable the older years?
older year selection should show the selected value.
Versions
Clarity project:
- Clarity Core
- Clarity Angular/UI
Clarity version:
- v3.x
- v4.x
- v5.x
Framework:
- Angular
- React
- Vue
- Other:
Framework version:
ie: Angular 11
Device:
- Type: [e.g. MacBook]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Additional notes
Hi @muruganG,
Seems like we have a logic that doesn't allow years under 999 to be selected. https://github.com/vmware/clarity/blob/648fb89ed867f508c9057a9cc6a835b376a78609/projects/angular/src/forms/datepicker/utils/date-utils.ts#L29
Would you like to give us some clarity about your case?
I also would encourage you to check our Clarity Core datepicker that doesn't give you such restrictions and give you all the freedom to select whatever date you need. https://clarity.design/storybook/core/?path=/story/forms-date--page
There are two thing need to understand. I went throw the documentation
- its allowing to select older years and date if not valid date should not clear previous selected date and year. that is the problem currently facing. (Spet 4 snapshot its cleared existing selected value, because of invalid date and year)
- Is there any way we can block older year selection any custom approach?
What I believe it will be the best approach here is to set a min
on the input
and hook on (ngModelChange)
or (change)
and maintain the state manually to keep the previous selected inside the input if the new value is not a valid one. The min
property will prevent the datepicker to disable older than the min
dates to be selected but at the same time it won't prevent manual entrance.
Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.