Selects wrong date when typing date with leading 0 on month in timezones that are behind UTC
Describe the bug When the computer has a timezone selected that is behind UTC, e.g. Hawaii, typing the date "2023-02-07" will select the date 6th of February 2023.
If you type "2023-2-07" it will correctly select the 7th of February 2023.
If your computer is set to use UTC or a timezone ahead of UTC, e.g. Australia, then both strings will select the correct date.
To Reproduce Steps to reproduce the behavior: My react code
<DatePicker
className={styles['date-range-custom-dates-start']}
onChange={(val: Date) => { store.setPopupStart(val); }}
selected={store.popupStartDate}
name="customDateStart"
autoComplete="off"
dateFormat="P"
locale="currentLocale"
isClearable
/>
- Set timezone to be Hawaii
- Click on the datepicker field
- Type "2023-02-07"
The 6th of February is incorrectly selected
Expected behavior The 7th of February 2023 should be selected
Screenshots
Desktop (please complete the following information):
- OS: Windows 10
- Browser Microsoft Edge
- Version 115.0.1901.203 (Official build) (64-bit)
Additional context Add any other context about the problem here.
Any updates? I have same error
This solution might work for you: https://stackoverflow.com/a/67599505/5071753
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.