Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • About Bonfire
Federation Bot
Federation Bot
@Federation_Bot  ·  activity timestamp 2 months ago

Fixing "Date/time not in ISO 8601 format" in Google Search Console

https://shkspr.mobi/blog/2025/12/fixing-date-time-not-in-iso-8601-format-in-google-search-console/

I like using microdata within my HTML to provide semantic metadata. One of my pages had this scrap of code on it:

 HTML<time
itemprop="datePublished"
itemscope
datetime="2025-06-09T11:27:06+01:00">9 June 2025 11:27</time>

The Google Search Console was throwing this error:

Date/time not in ISO 8601 format in field 'datePublished' Items with this issue are invalid. Invalid items are not eligible for Google Search's rich results

I was fairly sure that was a valid ISO 8601 string. It certainly matched the description in the Google documentation. Nevertheless, I fiddled with a few different formats, but all failed.

On the advice of Barry Hunter, I tried changing the datetime attribute to content. That also didn't work.

Then I looked closely at the code.

The issue is the itemscope. Removing that allowed the code to pass validation. But why?

Here's what the Schema.org documentation says:

By adding itemscope, you are specifying that the HTML contained in the block is about a particular item.

The HTML specification gives this example:

 HTML<div itemscope>
<img itemprop="image" src="google-logo.png" alt="Google">
</div>

Here, the image property is the value of the element. In this case google-logo.png. So what's the problem with the time example?

Well, <image> is a void element. It doesn't have any HTML content - so the metadata is taken from the src attribute.

But <time> is not a void element. It does contain HTML. So something like this would be valid:

 HTML<time
itemprop="datePublished"
itemscope
>2025-06-09T11:27:06+01:00</time>

The text contained by the element is a valid ISO8601 string.

My choice was either to present the ISO8601 string to anyone viewing the page, or simply to remove the itemscope. So I chose the latter.

#HTML #metadata #schemaOrg
Date/time not in ISO 8601 format in field 'datePublished' Items with this issue are invalid. Invalid items are not eligible for Google Search's rich results
Date/time not in ISO 8601 format in field 'datePublished' Items with this issue are invalid. Invalid items are not eligible for Google Search's rich results
Date/time not in ISO 8601 format in field 'datePublished' Items with this issue are invalid. Invalid items are not eligible for Google Search's rich results

HTML Standard

https://schema.org/docs/gs.html#microdata_itemscope_itemtype

ISO8601 string not validating. - Google Search Central Community

Google for Developers

Discussion Forum (DiscussionForumPosting, SocialMediaPosting) Schema Markup | Google Search Central  |  Documentation  |  Google for Developers

You can use discussion forum structured data to help Google understand your community forum content.
  • Copy link
  • Flag this post
  • Block

BT Free Social

BT Free is a non-profit organization founded by @ozoned@btfree.social . It's goal is for digital privacy rights, advocacy and consulting. This goal will be attained by hosting open platforms to allow others to seamlessly join the Fediverse on moderated instances or by helping others join the Fediverse.

BT Free Social: About · Code of conduct · Privacy ·
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Code of Conduct