Skip to content

Datepicker wrong days labels for UK user timezone and website US timezone near UK DTS period. #67478

@MaksVeter

Description

@MaksVeter

Description

The DatePicker calendar displays wrong date labels for users in UK when the website is in US tz.
All Day's labels are shifted by 1 back. Doing the debug - found that the issue happen because of two libs (date-fns and moment.js) used in Gutenberg works differently with Day Saving Time switches. The date-fns is used for defining start of week, month etc. when moment is used as main lib to works with dates.
So when getting calendar array with dates from date-fns - the calendar contain dates in different timezones before and after DTS. So moment.js don't care about it and think it's in the same timezone.
This is similar issue to #56844 and #47698

Step-by-step reproduction instructions

  1. Set local UK timezone
  2. Set website US timezone (America/New_York)
  3. Go to post with Gutenberg enabled
  4. Open the post date picker
  5. find the October 2024 and November 2024
  6. Check the day's labels

Screenshots, screen recording, code snippet

Screen.Recording.2024-12-02.at.14.34.07.mov

Environment info

  • WP 6.5, default Gutenberg version for this WP version (Also checked on the 6.7.1, 6.6.2)
  • Chrome Version 130.0.6723.70 (Official Build) (x86_64)
  • Mac OS 14.5 (23F79)

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions