DatePicker typed-input enters wrong date when typing some ISO dates
theosanderson opened this issue · 0 comments
What version of rsuite are you using?
5.58.1
What version of React are you using?
18.2
What version of TypeScript are you using (if any)?
No response
What browser are you using?
Chrome
Describe the Bug
If I want to type an ISO-formatted date into the date picker, this normally works. But if I want to type a date like 2023-03-05
, the natural inclination is to:
- Type
2023
- (the selection moves to the month)
- Type
03
- (the selection moves to the day)
- Type
05
If you do this on a DatePicker
or a controlled DateInput
you get the date 2023-02-05
inserted, one month previous.
The reason is that as you type 05
for the day, you initially type 0
, and the date 2023-03-00
is then updated to 2023-02-28
, and then as you press 5
to update the day, that becomes 2023-02-05
Expected Behavior
The component could detect non-existent dates like 2023-03-0
and not try to convert them into a date until a full date is entered.
To Reproduce
Type 20230305
in the top example on https://rsuitejs.com/components/date-picker/, the result is 2023-02-05