DatePicker Resets Day When Editing Year if System and DatePicker Timezones Differ
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When manually editing the year in an MUI X `` using the Day.js adapter, the day resets to `01` after entering the third digit of the year if the date picker timezone differs from the system timezone.
The issue appears to be daylight savings time related as it is only present when both timezones observe daylight savings time.
The behavior only affects the `@mui/x-date-pickers/AdapterDayjs` adapter. The date picker works correctly when using the `@mui/x-date-pickers/AdapterLuxon` adapter.
Steps to reproduce:
_* Must be performed with a system timezone that is not `America/Chicago`._
1. On the [MUI React Date Pickers](https://mui.com/x/react-date-pickers/timezone/#supported-timezones) page navigate to the date picker selector under the "Supported timezone" heading.
2. Select the AMERICA/CHICAGO tab.
3. In the date picker, edit the year by typing in 2-0-2-2.
4. The day will change from `17` to `01` when 2-0-2 is entered.
---
---
System timezones where the issue occurs:
- `America/New_York`
- `America/Denver`
- `America/Los_Angeles`
System timezone where the issue does not occur:
- `Pacific/Honolulu`
**Expected behavior**
The day remains the same when editing the year.
**Information**
- Day.js Version: v1.11.19
- OS: Windows 11
- Browser: Microsoft Edge Version 145.0
- Time zone: GMT-05:00 DST (Eastern Standard Time)
Contributor guide
Assessment
This issue has not been assessed yet.