User:Mtanalin/time element

From W3C Wiki

Below are proposals by Marat Tanalin.

  1. Simplify datetime syntax
  2. Keep @pubdate attribute
  3. Rename @datetime attribute to @value
  4. Add @update (or @pubupdate) attribute

Simplify datetime syntax

It makes sense to simplify datetime syntax to make it more human-readable. It's best to base it on MySQL datetime syntax as it's both human- and machine-readable.

Exact steps:

  1. Avoid "T" as date/time separator, and use space character (U+0020) instead.
  2. Add dedicated @tz attribute to specify exact timezone (if any).

Avoid "T" as date/time separator, and use space character (U+0020) instead

This datetime is human-readable:

<time>2011-11-12 19:20</time>

While this is not:

<time>2011-11-12T19:20</time>

Currently, we are forced to use almost identical datetimes both in contents and @datetime attribute in this situation to provide both human- and machine-readable datetimes:

<time datetime="2011-11-12T19:20">2011-11-12 19:20</time>

though the only difference here is exact separator ("T" instead in @datetime attribute instead of space in human-readable date in element's contents). It's redundant, irrational, and not quite usable.

Therefore "T" as date/time separator should be replaced with space character.

Add dedicated @tz attribute to specify exact timezone (if any)

<time tz="-8">2011-11-12 19:20</time>

@tz attribute can contain timezone offset in hours (with leading dash used in value for negative offsets).

Advantage of using dedicated attribute for timezone is that it can be applied to date represented by TIME element's contents, thus preventing authors from duplicating date partially or entirely in both contents and @datetime attribute.

Note that @tz attribute has nothing to do with timezone as TIME element value itself. @tz attribute is intended to be used in conjunction with datetime value provided separately: either by element's contents or by @datetime attribute value.

The @tz attribute is optional.

Keep @pubdate attribute

Tantek Çelik has proposed to drop @pubdate attribute.

His argument was:

The pubdate attribute is a vestigial piece of markup left-over from the attempt to provide automatic HTML5 to Atom conversion, and in practice is either not used, or typically used in conjunction with the hAtom microformat which doesn't supersets its functionality.

But most of real-world authors don't care about Atom. They just want to add semantic sense to their HTML content. @pubdate attribute is part of this semantics and therefore should not be dropped.

@pubdate attribute could be used no just by search robots, but also by screen readers / speech browsers to say user that exact date is not just a date, but exactly publication date.

Note that microformats cannot be considered an equivalent replacement for @pubdate attribute since markup cannot and should not be replaced with pseudo-markup. Pseudo-markup (microformats) should be supplement to true markup (real HTML semantics), not replacement for it. Microformats are verbose, unusable, and littered semantics surrogate, not semantics itself at all.

@pubdate attribute is an easy (hugely easier than microformats) way to markup publication date that people likely will be use while most of real-world authors will likely avoid using microformats at all. So without @pubdate attribute we'll just end up with less informative HTML documents since they will not contain neither semantic (@pubdate) nor pseudo-semantic (microformats) information about publication date at all.

@pubdate attribute should not be dropped noway.

See also Ian Devlin’s thoughts in support of @pubdate attribute.

Rename @datetime attribute to @value

"datetime" is too narrow name for attribute with so wide range of possible values. "value" is more common yet intuitive name, thus this is more viable to be used with different variants of dates, be it full datetimes like "YYYY-MM-DD hh:mm:ss" or partial dates or times like "YYYY" or "hh:mm". Both latter ones are not datetimes at all, and using attribute named "datetime" for something that is actually not datetime can be confusing.

Additionally, @value attribute name (not format of attribute's value, of course) would be consistent with same-named attribute of other elements like OPTION.

Renaming @datetime attribute to @content (instead of @value) is less desirable since it could be confused with element's text content. (Renaming @datetime to @content has been proposed by Peter Winnberg)

Add @update (or @pubupdate) attribute

Additionally, supplementary @update (or @pubupdate) boolean attribute should be added to mark up update dates (see bug 14202). Rationale is similar to that for @pubdate attribute.