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:
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.