Skip to content

Fix PostDate using browser timezone instead of WordPress site timezone#404

Open
s3rgiosan wants to merge 2 commits into10up:developfrom
s3rgiosan:fix/post-date-timezone
Open

Fix PostDate using browser timezone instead of WordPress site timezone#404
s3rgiosan wants to merge 2 commits into10up:developfrom
s3rgiosan:fix/post-date-timezone

Conversation

@s3rgiosan
Copy link
Member

@s3rgiosan s3rgiosan commented Mar 17, 2026

Description of the Change

PostDate was hardcoding the browser's timezone via Intl.DateTimeFormat().resolvedOptions().timeZone and passing it to
dateI18n(). This overrode the WordPress site's configured timezone, causing the editor to display incorrect timezone
abbreviations (e.g., WET instead of EST).

This PR removes the hardcoded browser timezone and adds an optional timezone prop to PostDate. When the prop is not
provided, dateI18n() correctly falls back to the WordPress site timezone from getSettings(), which is the expected
behavior. The prop can still be used to explicitly override the timezone when needed.

Closes #

How to test the Change

  1. Set the WordPress site timezone to America/New_York (Settings → General) → the editor should show EST/EDT.
  2. Pass a timezone="Europe/London" prop to PostDate → should override to GMT/BST.
  3. Leave the timezone prop unset with a UTC site setting → should show UTC.

Changelog Entry

Fixed - PostDate now uses the WordPress site timezone instead of the browser timezone when formatting dates.

Credits

Props @s3rgiosan

Checklist:

@s3rgiosan s3rgiosan requested a review from fabiankaegy March 17, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant