Skip to content

DatePicker Resets Day When Editing Year if System and DatePicker Timezones Differ #3014

@apogeeoak

Description

@apogeeoak

Describe the bug
When manually editing the year in an MUI X <DatePicker /> 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 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.
Image
Image
Image

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions