DatePicker: abnormal display when setting a past date to maxDate
Describe the bug When I set the 'maxDate' prop of datePicker component with any date before today (the current date), the year becomes 0001, the 'value' prop is empty by default
To Reproduce Steps to reproduce the behavior:
- set 'dd/MM/YYYY' to formatPattern
- set any date before the current date to maxDate
- click the datePicker
Expected behavior the year should be the current year, not 0001
Screenshots

Hello @natsu0728
This is the expected behavior of the ui5-datepicker. In order to understand it, I have created a CodeSandbox Sample, which shows how it woks.
By default if either min-date, max-date, or both are set, the initial focus of the datepicker goes to the first date, that can be selected. This can be as follows:
- If only
min-dateis set, the focus will go to the value ofmin-date - If
min-dateandmax-dateare set, the focus will go to the value ofmin-date - If only
max-dateis set, the focus will go to the first date that can be selected, which is 01.01.0001.
In your case, you can use one of the following workarounds:
- Set a
min-date, so that the focus will not go the the first year. - Set the value of the datepicker to today/yesterday by default. This way, when the datepicker is opened, the focused date will be under your control.
@fifoosid
If only max-date is set, the focus will go to the first date that can be selected, which is 01.01.0001.
In this case, I found that the focus goes to 01/01/0001 only when I set max-date with a past date. If the max-date is in the future (such as 30/09/2020), everything works well, though min-date is also not set. ps. Setting a value by default is a good solution for me, thanks !