Goodbye HTML5 <time>, hello <data>!

This post is obsolete. See The return of <time> for the latest information.

It’s with great sadness that I inform you that the HTML5 <time> element has been dropped, and replaced by a more generic – and thus less useful – <data> element. The pubdate attribute has been dropped completely, so there is now no simple way to indicate the publication date of a work.

Editor Ian “Hixie” Hickson explained:

There are several use cases for <time>:

A. Easier styling of dates and times from CSS.

A way to mark up the publication date/time for an article (e.g. for
conversion to Atom).

C. A way to mark up machine-readable times and dates for use in Microformats or
microdata.

Use cases A and B do not seem to have much traction.

Use case C applies to more than just dates, and the lack of solution for stuff
outside dates and times is being problematic to many communities.

Proposal: we dump use cases A and B, and pivot <time> on use case C, changing
it to <data> and making it like the <abbr> for machine-readable data, primarily
for use by Microformats and HTML’s microdata feature.

I think this is a bad decision.

<time> was originally dreamed up to correct an accessibility problem with microformats that James Craig and I raised in 2007.

While Hixie says it hasn’t had much traction in microformats. Ben Ward, a platform developer at Twitter and microformats admin, says “We’ve had time documented on the wiki HTML5 page for ages, some parsers had experimental support. But <time> wouldn’t be able to progress into being a requirement or even recommendation for Microformats until HTML5 had that status”.

It’s also used on reddit.com and github.com (with Alexa rankings of 112 and 549, respectively – hat-tip, Mike Taylor), the Boston Globe and default WordPress theme, twentyeleven (which has a mere 2.6 million installs). It’s also used in the Atlassian suite of products: JIRA, Confluence, Bamboo and BitBucket (hat-tip Ben Buchanan). Drupal developers have been adding it to the core theming systems, too.

<time> (or its precursor, <date>) has an obvious semantic (easy to learn, easy to read). Because it’s restricted to dates and times, the datetime attribute has a specific syntax that can be checked by a validator. Conversely, <data value=””> has no such built-in syntax, as it’s for arbitrary lumps of data, so can’t be machine validated. This will lead to more erroneous dates being published. Therefore, the reliability and thus the utility of the information being communicated in machine-readable format diminishes.

The <data> spec says “A script loaded by the page (and thus privy to the page’s internal convention of marking up dates and times using the data element) could scan through the page and look at all the data elements therein to create an index of dates and times.”

This is a retrograde step from the <time> element that uses a wider standard/ convention for dates, such as ISO8601 because now the script must be “privy to the page’s internal convention”.

<data> as an element is for public consumption, eg for crawlers, search engines, microformats/ microdata parsers. Convesely, data-* attributes are private (only for scripts on a page, not external crawlers: “These attributes are not intended for use by software that is independent of the site that uses the attributes.” ). This is highly confusing.

I’ve added these points to a collaborative notepad set up by Eric Eggert, at his request.

But I have little hope that <time> and pubdate will be restored, even though most comments on the bug in which Hixie changed the spec were negative.

But sing along with me in my Cher costume, and we might just change Hixie’s mind.

Added 20:06 Oct 30: The Mighty Steve Faulkner filed a revert request.

Usual disclaimer: personal opinion, written on Sunday night, not Opera, etc etc.

Other discussion

Update 4 November 2011

At an HTML Working Groupp meet last night, it was decided to re-instate <time> and even extend it to encompass things I complained in 2009 were lacking — “fuzzy dates” like “1965” or “February 2008” and durations.

However, it remains to be seen whether it’ll be reinstated in both the W3C spec and the WHATWG versions or just the W3C. So I’ll delay celebration until then.

115 Responses to “ Goodbye HTML5 <time>, hello <data>! ”

Leave a Reply

HTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> . To display code, manually escape it.