A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Time element accepted

From WHATWG Wiki
Jump to navigation Jump to search

Summary: Research, data, use cases, issues, and enhancements related to the HTML5 time element (see also W3C TR time snapshot) that have been adopted in HTML (and HTML5).

HTML5's new <time> element presents a huge opportunity to improve the publishing of datetime information on the web, the biggest opportunity since the introduction of hCalendar and other time-based microformats.

The time element has been improved through the research done on this page.

For other proposals for improving the <time> element, see:

Tantek (and other proposal authors).


year only

Status
2011-11-18 Adopted in WHATWG HTML.
Summary
The time element should accept just a year.
ISO8601 syntax
YYYY

year only use cases

use case research:

  • http://microformats.org/wiki/birthday-examples#year_only
  • use cases in VCARDDAV & EDTF - see external links
  • Wikipedia 'Start date' template - thousands of YYYY instances
  • Wikipedia infobox with YYYY birthdate (unknown MM-DD)
  • Copyright notices are often year-only; e.g. that at the foot of [1]
  • In biological taxonomy, a species', genus' or other rank's authority (the person who named it, and the year they did so) always includes a whole-year date value. For example:
    • Barn Owl, Tyto alba (Scopoli, 1769) [2]
    • Strigiformes (Wagler, 1830) [3]
  • Photo date taken
  • Citations from a bibliography which list two or more works by the same author disambiguate them by year
  • Commerce
    • "a piece of jewellery hallmarked 1933"
    • "a 1973 Chevy"
  • Sport
    • 2008 Olympics
    • 1966 World Cup
  • Awards
    • "1973 Oscar for best film"
    • "1988 Nobel Peace Prize"
  • Restyling dates for localisation and to follow user conventions
    • 2010 to 平22年 to 2010年 (all acceptable ways to represent 2010 in Japan)
  • Relative dates in texts: news websites and blogs often use phrases such as
    • "damages during last year's Gaza offensive" [4],
    • "recession next year almost inevitable" [5]

year only discussion

Opinions / discussion:

  • +1 Faruk (per Bug 7145 - Valid date strings should accept ambiguous inputs, like "2009" or "2007-01") One example is the very common archive view found on most blogs, which contain distinct links or headers for each year, each month per year, and often each date within a chosen or highlighted month. Currently, the <time> element only allows for datetime values as precise as a specific day, e.g. YYYY-MM-DD.
  • -1 Hixie - "Without clear use cases, I don't intend to change the spec here." (ibid)
  • +1 Tantek (per HTML5 Super Friends Technical Details: time element)
  • +1 Andy Mabbett (Per use cases in VCARDDAV & EDTF - see external links)
  • +1 Philip Jägenstedt - for marking up release dates on e.g. MusicBrainz where the date is given as YYYY, YYYY-MM or YYYY-MM-DD.
  • +1 Asbjørn Ulsberg - for marking up years on Wikipedia ("...global military conflict lasting from 1939 to 1945...").
  • +1 Glenn Jones - This is often used to format date description for resume's Stackoverflow http://careers.stackoverflow.com/klmr I could list more cases in the wild. Like YYYY, YYYY-MM or YYYY-MM-DD its part of the http://www.w3.org/TR/NOTE-datetime profile.
  • +1 Oli Studholme This would be useful for semantically marking up years, as in Japan there’s an additional era-based method of representing years (and even Japanese people find it difficult to convert between them), and it would allow the browser to automatically display the user-preferred format. It would also also enable browser-based localisation (adding a 年 after the year). Finally it would be useful for marking up future imprecise dates (e.g. events being planned), allowing someone to add these dates to a calendar automatically (rather than marking up teh events plus manually adding them to a calendar). ref: email to WHATWG
  • +1 Martin Janecke - This would be great to mark up relative dates ("next year I will …") that actually refer to an absolute date in the context of the text and the publication date of the text respectively.
  • +1 drublic - As input-fields support `year` the datetime-attribute as it is (was until ) should also allow users to define year-only dates. Furthermore it will help making newspapers, wikis and quotations more accessible and semantically powerful.
  • ...

year only related posts

Related posts (listed with quotes directly related to year only) :

  • 2009-02-23 Dates and coordinates in HTML5 blog post by Andy Mabbett -

    hCalendar microformats are already used to mark up imprecise dates (“June 1977″; “2009″). ISO8601 already supports them. Why not HTML5?

  • 2009-02-25 HTML 5, politics and me blog post by Bruce Lawson - look for mention of "time element" which mentions:

    I see no reason why authors shouldn’t be able to mark up ... dates like ... “1935″ which are currently disallowed by the spec

year only next steps

Per this edit/comment from Ian: http://lists.w3.org/Archives/Public/public-html-diffs/2010Aug/0234.html

We need to help create a CSS feature for styling dates to local conventions (e.g. 2000-12-31 vs 31-12-2000 vs 12-31-2000 vs Japanese conventions for year and year-month). Once such a CSS feature exists, it will apparently provide additional weight for including year-only dates in the time element.


year month only

Status
2011-11-18 Adopted in WHATWG HTML.
Summary
The time element should accept just a year and a month.
ISO8601 syntax
YYYY-MM

year month use cases

  • Blog/publishing archive pages - see Benward.me, ablognotlimited.com (need specific links to archive pages)
  • output equivalent of <input type="month">, see impedance match new date time inputs.
  • use cases in VCARDDAV & EDTF - see external links
  • Wikipedia 'Start date' template - thousands of YYYY-MM instances
  • Photo date taken
  • Credit/ debit card expiry dates, entered into, then republished for verification on, e-commerce sites (security concerns prohibit use of example URL)
  • Restyling dates for localisation and to follow user conventions
    • 2010-08 to 08-2010 to 平22年8月 to 2010年8月 (all acceptable ways to represent August 2010 in Japan)
  • Relative dates in text: news websites, blogs and statistical institutes often use phrases like:
    • "in June 2010, the turnover […] decreased by 10.5% compared to the same month of the previous year." [6]
    • "George W. Bush leaves office in January next year" [7]

year month discussion

Opinions / discussion:

  • +1 Faruk (per Bug 7145 - Valid date strings should accept ambiguous inputs, like "2009" or "2007-01") One example is the very common archive view found on most blogs, which contain distinct links or headers for each year, each month per year, and often each date within a chosen or highlighted month. Currently, the <time> element only allows for datetime values as precise as a specific day, e.g. YYYY-MM-DD.
  • -1 Hixie - "Without clear use cases, I don't intend to change the spec here." (ibid)
  • +1 Tantek I think the blog archives use case (where blogs often link to their archives by a specific month and year) is sufficient to justify adding this capability to the time element. Content hosting sites like Flickr also list archives by specific year/month, e.g. see http://www.flickr.com/photos/tantek/archives/
  • +1 Andy Mabbett (Per use cases in VCARDDAV & EDTF - see external links)
  • +1 Philip Jägenstedt - for marking up release dates on e.g. MusicBrainz where the date is given as YYYY, YYYY-MM or YYYY-MM-DD.
  • +1 Asbjørn Ulsberg - for marking up month+year on Wikipedia ("In July 1937, Japan captured the former Chinese imperial capital of Beiping...").
  • +1 Glenn Jones - This is the most commonly used format date description for Resume's. Linked-in use it http://www.linkedin.com/in/steveganz and Stackoverflow http://careers.stackoverflow.com/klmr I could list many more cases in the wild.
  • +1 Oli Studholme As with the year example above, this would be useful for semantically marking up year-month dates, as in Japan there’s an additional era-based method of representing years (and even Japanese people find it difficult to convert between them), and it would allow the browser to automatically display the user-preferred format. It would also also enable browser-based localisation (adding a 年 after the year, and 月 after the month). Having this data semantically notated would help make the use in Japan of 2-digit years on credit cards and in e-commerce more accessible. Finally it would be useful for marking up future imprecise dates (e.g. events being planned), allowing someone to add these dates to a calendar automatically (rather than marking up teh events plus manually adding them to a calendar). [ref: email to WHATWG]
  • +1 Martin Janecke - This would be great to mark up relative dates ("next January I will …") that actually refer to an absolute date in the context of the text and the publication date of the text respectively.
  • ...

year month related posts

Related posts (listed with quotes directly related to year-month) :

  • 2009-02-23 Dates and coordinates in HTML5 blog post by Andy Mabbett -

    hCalendar microformats are already used to mark up imprecise dates (“June 1977″; “2009″). ISO8601 already supports them. Why not HTML5?

  • 2009-02-25 HTML 5, politics and me blog post by Bruce Lawson - look for mention of "time element" which mentions:

    I see no reason why authors shouldn’t be able to mark up ... dates like “July 2008″ ... which are currently disallowed by the spec

  • 2009-03-06 Marking up a blog with HTML 5 (part 2) : Time blog post by Bruce Lawson:

    I suggest the spec be amended to allow dates like "July 1966"

  • 2009-08-20 HTML 5: what’s hot, what’s not blog post by Bruce Lawson - see section on TIME which explicitly mentions:

    The time element is still hamstrung by not being able to markup ... dates like “December 1935″

  • 2009-08-30 HTML5 and me blog post by Jeremy Keith - see section on "time" which explicitly mentions

    make a piece of information like “April 1912” machine-readable

  • 2010-02-09 The time element (and microformats) blog post on HTML5 Doctor by Bruce Lawson - mentions:

    The only trouble with <time> is that the [sic] it must contain positive date on the Proleptic Gregorian calendar, meaning you can’t encode a date before the Christian Era. Neither can you encode imprecise dates such as “July 1904″.

year month next steps

Per this edit/comment from Ian: http://lists.w3.org/Archives/Public/public-html-diffs/2010Aug/0234.html

We need to help create a CSS feature for styling dates to local conventions (e.g. 2000-12-31 vs 31-12-2000 vs 12-31-2000 vs Japanese conventions for year and year-month). Once such a CSS feature exists, it will apparently provide additional weight for including year-month dates in the time element.

year week only

Status
2011-11-18 Adopted in WHATWG HTML.
Summary
The time element should accept just a year and a week number.
ISO8601 syntax
YYYY-WNN
reasoning
to provide the output equivalent of <input type="week">

year week only use cases

  • output equivalent of <input type="week">, see impedance match new date time inputs above.
  • OpenStreetMap's opening_hours tag allows specification of opening hours (of business, shops, parks etc.) by week number. See example, documentation
  • ... Please add any more sites which publish references to specific weeks of a year, either by name / expression (e.g. "first week of the year") or by specific number (e.g. "weeks 1-26"), please provide URLs and quotes of example content.

year week only discussion

Opinions / discussion:

  • +1 Tantek per good design of impedance matching date time inputs.
  • ...

month day only

Status
2011-11-18 Adopted in WHATWG HTML.
Summary
The time element should accept just a month and a day.
ISO8601 syntax
--MM-DD
use case research
http://microformats.org/wiki/birthday-examples#month_and_day_only
use cases discussed in VCARDDAV & EDTF - see external links
Facebook - allows users to elect to show their birthday as, for example, "17 December", with no year.

Opinions / discussion:

HTML5 internal consistency

impedance match new date time inputs

Status
2011-11-18 Adopted in WHATWG HTML.
Summary
More reasoning for broader date time granularity - to impedance match new date time inputs.

The time element should be able to represent every granularity of times and dates that the new date time <input> elements allow. Here is a list of all the date time <input> elements along with the corresponding <time> element usage (if applicable)

<input type="date">           - <time>YYYY-MM-DD</time>
<input type="datetime">       - <time>YYYY-MM-DDTHH:MM:SS</time>
<input type="month">          - <time>YYYY-MM</time> (as of 2011-11-18)
<input type="week">           - <time>YYYY-Www</time> (as of 2011-11-18)
<input type="time">           - <time>HH:MM:SS</time>
<input type="datetime-local"> - <time>HH:MM:SS-ZZ:YY</time>

In particular the <time> should have support for the following date inputs:

Opinions / discussion:

See Also