Skip to content

[Bug]: Schema datePublished and dateModified do not take into account the timezone #23153

@afercia

Description

@afercia

Prerequisites

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

Discovered after a Copilot review, see https://github.com/Yoast/Platform/pull/4325#discussion_r3063025239
In that PR for the yoast.com Platform we needed to modify the dateModified value based on an ACF field, but that's not the point.

It appears all the various Schema implementations in the Yoast SEO plugin always use UTC with no timezone for the datePublished and dateModified. They use a format helper which doesn't do anything about the timezone. I'd like to suggest to consider to use wp_date() to output a timezone value when it's not UTC.

We fixed it for our use case, but only for dateModified. It would be good to consider a fix in the plutin itself.

Image

Step-by-step reproduction instructions

  1. Go to WP Admin > Settings > General Settings > Timezone, and set a timezone other then UTC. The one on Platform is set to Amsterdam so it's currently +
  2. Create a new post and publish it.
  3. Modify the post and save it.
  4. On the front end, inspect the schema in the source. The datePublished and dateModified are present in both the Article and WebPage types.
  5. Observe the date/time values have a timezone +00:00
  6. Expected: +02:00

Current output example:

"datePublished": "2026-04-01T07:10:34+00:00",
"dateModified": "2026-04-07T12:00:00+00:00",

Expected:

"datePublished": "2026-04-01T07:10:34+02:00",
"dateModified": "2026-04-07T12:00:00+02:00",

Suggest to test with other timezone values set in the WP admin, including 'exotic' values e.g.:

UTC+8:45
UTC-3:30

Expected results

  1. The date/time values to have the correct timezone

Actual results

  1. it;s awlays UTC +00:00

Screenshots, screen recording, code snippet

No response

Which editor is affected (or editors)

  • Block Editor
  • Gutenberg Editor
  • Elementor Editor
  • Classic Editor
  • Other (please specify in additional info)

Which browser is affected (or browsers)

  • Chrome
  • Firefox
  • Safari
  • Other (please specify in additional info)

Device you are using

No response

Operating system

No response

PHP version

No response

WordPress version

6.9.4

WordPress Theme

No response

Yoast SEO version

trunk

Gutenberg plugin version (if relevant)

No response

Elementor plugin version (if relevant)

No response

Classic Editor plugin version (if relevant)

No response

Relevant plugins in case of a bug

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions