Terence Eden. He has a beard and is smiling.
Theme Switcher:

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

· 300 words · Viewed ~248 times


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.


Share this post on…

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

See allowed HTML elements: <a href="" title="">
<abbr title="">
<acronym title="">
<b>
<blockquote cite="">
<br>
<cite>
<code>
<del datetime="">
<em>
<i>
<img src="" alt="" title="" srcset="">
<p>
<pre>
<q cite="">
<s>
<strike>
<strong>

To respond on your own website, write a post which contains a link to this post - then enter the URl of your page here. Learn more about WebMentions.