Short URL: http://html5.org/r/6827
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 6827 | 2011-11-18 19:43 |
Index: source
===================================================================
--- source (revision 6826)
+++ source (revision 6827)
@@ -4955,6 +4955,119 @@
</div>
+ <h5>Yearless dates</h5>
+
+ <p>A <dfn title="concept-yearless-date">yearless date</dfn> consists
+ of a month and a day, but with no associated year.</p>
+
+ <p>A string is a <dfn>valid yearless date string</dfn> representing
+ a month <var title="">month</var> and a day <var title="">day</var>
+ if it consists of the following components in the given order:</p>
+
+ <ol>
+
+ <li>Optionally, two U+002D HYPHEN-MINUS characters (-)</li>
+
+ <li>Two <span title="concept-datetime-digit">digits</span>,
+ representing the month <var title="">month</var>, in the range
+ 1 ≤ <var
+ title="">month</var> ≤ 12</li>
+
+ <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+ <li>Two <span title="concept-datetime-digit">digits</span>,
+ representing <var title="">day</var>, in the range
+ 1 ≤ <var title="">day</var> ≤ <var
+ title="">maxday</var> where <var title="">maxday</var> is the <span
+ title="number of days in month month of year year">number of
+ days</span> in the month <var title="">month</var> and any
+ arbitrary leap year (e.g. 4 or 2000)</li>
+
+ </ol>
+
+ <p class="note">In other words, if the <var title="">month</var> is
+ "<code title="">02</code>", meaning February, then the day can be
+ 29, as if the year was a leap year.</p>
+
+ <div class="impl">
+
+ <p>The rules to <dfn>parse a yearless date string</dfn> are as
+ follows. This will return either a month and a day, or nothing. If
+ at any point the algorithm says that it "fails", this means that it
+ is aborted at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p>Let <var title="">input</var> be the string being
+ parsed.</p></li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var
+ title="">input</var>, initially pointing at the start of the
+ string.</p></li>
+
+ <li><p><span>Parse a yearless date component</span> to obtain <var
+ title="">month</var> and <var title="">day</var>. If this returns
+ nothing, then fail.</p>
+
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</p></li>
+
+ <li><p>Return <var title="">month</var> and <var
+ title="">day</var>.</p></li>
+
+ </ol>
+
+ <p>The rules to <dfn>parse a yearless date component</dfn>, given an
+ <var title="">input</var> string and a <var title="">position</var>,
+ are as follows. This will return either a month and a day, or
+ nothing. If at any point the algorithm says that it "fails", this
+ means that it is aborted at that point and returns nothing.</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> that are
+ U+002D HYPHEN-MINUS characters (-). If the collected sequence is
+ not exactly zero or two characters long, then fail.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">month</var>.</p></li>
+
+ <li><p>If <var title="">month</var> is not a number in the range
+ 1 ≤ <var title="">month</var> ≤ 12, then
+ fail.</p></li>
+
+ <li><p>Let <var title="">maxday</var> be the <span title="number of
+ days in month month of year year">number of days</span> in month
+ <var title="">month</var> of any arbitrary leap year (e.g. 4 or
+ 2000).</p></li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var
+ title="">input</var> or if the character at <var
+ title="">position</var> is not a U+002D HYPHEN-MINUS character,
+ then fail. Otherwise, move <var title="">position</var> forwards
+ one character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then fail. Otherwise,
+ interpret the resulting sequence as a base-ten integer. Let that
+ number be the <var title="">day</var>.</p></li>
+
+ <li><p>If <var title="">day</var> is not a number in the range
+ 1 ≤ <var title="">day</var> ≤ <var
+ title="">maxday</var>, then fail.</li>
+
+ <li><p>Return <var title="">month</var> and <var
+ title="">day</var>.</p></li>
+
+ </ol>
+
+ </div>
+
+
<h5>Times</h5>
<p>A <dfn title="concept-time">time</dfn> consists of a specific
@@ -5202,72 +5315,208 @@
</div>
+ <h5>Time zones</h5>
- <h5>Global dates and times</h5>
+ <p>A <dfn title="concept-timezone">time-zone offset</dfn> consists
+ of a signed number of hours and minutes.</p>
- <p>A <dfn title="concept-datetime">global date and time</dfn>
- consists of a specific proleptic Gregorian date, consisting of a
- year, a month, and a day, and a time, consisting of an hour, a
- minute, a second, and a fraction of a second, expressed with a
- time-zone offset, consisting of a signed number of hours and
- minutes. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+ <p>A string is a <dfn>valid time-zone offset string</dfn>
+ representing a time-zone offset if it consists of either:</p>
- <p>A string is a <dfn>valid global date and time string</dfn>
- representing a date, time, and a time-zone offset if it consists of
- the following components in the given order:</p>
+ <ul>
+
+ <li><p>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only
+ if the time zone is UTC</p></li>
+
+ <li>
+
+ <p>Or, the following components, in the given order:</p>
+
+ <ol>
+
+ <li>Either a U+002B PLUS SIGN character (+) or, if the
+ time-zone offset is not zero, a U+002D HYPHEN-MINUS character
+ (-), representing the sign of the time-zone offset</li>
+ <!-- the -00:00 offset is disallowed because RFC3339 gives it a
+ special semantic -->
+
+ <li>Two <span title="concept-datetime-digit">digits</span>,
+ representing the hours component <var title="">hour</var> of
+ the time-zone offset, in the range 0 ≤ <var
+ title="">hour</var> ≤ 23</li>
+
+ <li>A U+003A COLON character (:)</li>
+
+ <li>Two <span title="concept-datetime-digit">digits</span>,
+ representing the minutes component <var title="">minute</var>
+ of the time-zone offset, in the range 0 ≤ <var
+ title="">minute</var> ≤ 59</li>
+
+ </ol>
+
+ </li>
+
+ </ul>
+
+ <p class="note">This format allows for time-zone offsets from -23:59
+ to +23:59. In practice, however, the range of offsets of actual time
+ zones is -12:00 to +14:00, and the minutes component of offsets of
+ actual time zones is always either 00, 30, or 45.</p>
+
+ <p class="note">See also the usage notes and examples in the <span
+ title="concept-datetime">global date and time</span> section below
+ for details on using time-zone offsets with historical times that
+ predate the formation of formal time zones.</p>
+
+ <div class="impl">
+
+ <p>The rules to <dfn>parse a time-zone offset string</dfn> are as
+ follows. This will return either a time-zone offset, or nothing. If
+ at any point the algorithm says that it "fails", this means that it
+ is aborted at that point and returns nothing.</p>
+
<ol>
- <li>A <span>valid date string</span> representing the date</li>
+ <li><p>Let <var title="">input</var> be the string being
+ parsed.</p></li>
- <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>
+ <li><p>Let <var title="">position</var> be a pointer into <var
+ title="">input</var>, initially pointing at the start of the
+ string.</p></li>
- <li>A <span>valid time string</span> representing the time</li>
+ <li><p><span>Parse a time-zone offset component</span> to obtain
+ <var title="">timezone<sub title="">hours</sub></var> and <var
+ title="">timezone<sub title="">minutes</sub></var>. If this returns
+ nothing, then fail.</p>
- <li>Either:
+ <li><p>If <var title="">position</var> is <em>not</em> beyond the
+ end of <var title="">input</var>, then fail.</p></li>
- <ul>
+ <li><p>Return the time-zone offset that is <var
+ title="">timezone<sub title="">hours</sub></var> hours and <var
+ title="">timezone<sub title="">minutes</sub></var> minutes from
+ UTC.</p></li>
- <li>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only
- if the time zone is UTC</li>
+ </ol>
- <li>Or:
+ <p>The rules to <dfn>parse a time-zone offset component</dfn>, given
+ an <var title="">input</var> string and a <var
+ title="">position</var>, are as follows. This will return either
+ time-zone hours and time-zone minutes, or nothing. If at any point
+ the algorithm says that it "fails", this means that it is aborted at
+ that point and returns nothing.</p>
- <ol>
+ <ol>
- <li>Either a U+002B PLUS SIGN character (+) or, if the
- time-zone offset is not zero, a U+002D HYPHEN-MINUS character
- (-), representing the sign of the time-zone offset</li>
- <!-- the -00:00 offset is disallowed because RFC3339 gives it a
- special semantic -->
+ <li>
- <li>Two <span title="concept-datetime-digit">digits</span>,
- representing the hours component <var title="">hour</var> of
- the time-zone offset, in the range 0 ≤ <var
- title="">hour</var> ≤ 23</li>
+ <p>If the character at <var title="">position</var> is a U+005A
+ LATIN CAPITAL LETTER Z character (Z), then:</p>
- <li>A U+003A COLON character (:)</li>
+ <ol>
- <li>Two <span title="concept-datetime-digit">digits</span>,
- representing the minutes component <var title="">minute</var>
- of the time-zone offset, in the range 0 ≤ <var
- title="">minute</var> ≤ 59</li>
+ <li><p>Let <var title="">timezone<sub title="">hours</sub></var>
+ be 0.</p></li>
- </ol>
+ <li><p>Let <var title="">timezone<sub
+ title="">minutes</sub></var> be 0.</p></li>
- </li>
+ <li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>.</p></li>
- </ul>
+ </ol>
+ <p>Otherwise, if the character at <var title="">position</var> is
+ either a U+002B PLUS SIGN (+) or a U+002D HYPHEN-MINUS (-),
+ then:</p>
+
+ <ol>
+
+ <li><p>If the character at <var title="">position</var> is a
+ U+002B PLUS SIGN (+), let <var title="">sign</var> be
+ "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let <var
+ title="">sign</var> be "negative".</p></li>
+
+ <li><p>Advance <var title="">position</var> to the next character
+ in <var title="">input</var>.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">timezone<sub
+ title="">hours</sub></var>.</p></li>
+
+ <li>If <var title="">timezone<sub title="">hours</sub></var> is
+ not a number in the range 0 ≤ <var
+ title="">timezone<sub
+ title="">hours</sub></var> ≤ 23, then fail.</li>
+
+ <li>If <var title="">sign</var> is "negative", then negate <var
+ title="">timezone<sub title="">hours</sub></var>.</li>
+
+ <li><p>If <var title="">position</var> is beyond the end of <var
+ title="">input</var> or if the character at <var
+ title="">position</var> is not a U+003A COLON character, then
+ fail. Otherwise, move <var title="">position</var> forwards one
+ character.</p></li>
+
+ <li><p><span>Collect a sequence of characters</span> in the range
+ U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+ sequence is not exactly two characters long, then
+ fail. Otherwise, interpret the resulting sequence as a base-ten
+ integer. Let that number be the <var title="">timezone<sub
+ title="">minutes</sub></var>.</p></li>
+
+ <li>If <var title="">timezone<sub title="">minutes</sub></var> is
+ not a number in the range 0 ≤ <var
+ title="">timezone<sub
+ title="">minutes</sub></var> ≤ 59, then fail.</li>
+
+ <li>If <var title="">sign</var> is "negative", then negate <var
+ title="">timezone<sub title="">minutes</sub></var>.</li>
+
+ </ol>
+
+ <p>Otherwise, fail.</p>
+
</li>
+ <li><p>Return <var title="">timezone<sub title="">hours</sub></var>
+ and <var title="">timezone<sub
+ title="">minutes</sub></var>.</p></li>
+
</ol>
- <p class="note">This format allows for time-zone offsets from -23:59
- to +23:59. In practice, however, the range of offsets of actual time
- zones is -12:00 to +14:00, and the minutes component of offsets of
- actual time zones is always either 00, 30, or 45.</p>
+ </div>
+
+ <h5>Global dates and times</h5>
+
+ <p>A <dfn title="concept-datetime">global date and time</dfn>
+ consists of a specific proleptic Gregorian date, consisting of a
+ year, a month, and a day, and a time, consisting of an hour, a
+ minute, a second, and a fraction of a second, expressed with a
+ time-zone offset, consisting of a signed number of hours and
+ minutes. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p>A string is a <dfn>valid global date and time string</dfn>
+ representing a date, time, and a time-zone offset if it consists of
+ the following components in the given order:</p>
+
+ <ol>
+
+ <li>A <span>valid date string</span> representing the date</li>
+
+ <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>
+
+ <li>A <span>valid time string</span> representing the time</li>
+
+ <li>A <span>valid time-zone offset string</span> representing the time-zone offset</li>
+
+ </ol>
+
<p>Times in dates before the formation of UTC in the mid twentieth
century must be expressed and interpreted in terms of UT1
(contemporary Earth solar time at the 0° longitude), not UTC
@@ -5428,95 +5677,6 @@
</ol>
- <p>The rules to <dfn>parse a time-zone offset component</dfn>, given
- an <var title="">input</var> string and a <var
- title="">position</var>, are as follows. This will return either
- time-zone hours and time-zone minutes, or nothing. If at any point
- the algorithm says that it "fails", this means that it is aborted at
- that point and returns nothing.</p>
-
- <ol>
-
- <li>
-
- <p>If the character at <var title="">position</var> is a U+005A
- LATIN CAPITAL LETTER Z character (Z), then:</p>
-
- <ol>
-
- <li><p>Let <var title="">timezone<sub title="">hours</sub></var>
- be 0.</p></li>
-
- <li><p>Let <var title="">timezone<sub
- title="">minutes</sub></var> be 0.</p></li>
-
- <li><p>Advance <var title="">position</var> to the next character
- in <var title="">input</var>.</p></li>
-
- </ol>
-
- <p>Otherwise, if the character at <var title="">position</var> is
- either a U+002B PLUS SIGN (+) or a U+002D HYPHEN-MINUS (-),
- then:</p>
-
- <ol>
-
- <li><p>If the character at <var title="">position</var> is a
- U+002B PLUS SIGN (+), let <var title="">sign</var> be
- "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let <var
- title="">sign</var> be "negative".</p></li>
-
- <li><p>Advance <var title="">position</var> to the next character
- in <var title="">input</var>.</p></li>
-
- <li><p><span>Collect a sequence of characters</span> in the range
- U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
- sequence is not exactly two characters long, then
- fail. Otherwise, interpret the resulting sequence as a base-ten
- integer. Let that number be the <var title="">timezone<sub
- title="">hours</sub></var>.</p></li>
-
- <li>If <var title="">timezone<sub title="">hours</sub></var> is
- not a number in the range 0 ≤ <var
- title="">timezone<sub
- title="">hours</sub></var> ≤ 23, then fail.</li>
-
- <li>If <var title="">sign</var> is "negative", then negate <var
- title="">timezone<sub title="">hours</sub></var>.</li>
-
- <li><p>If <var title="">position</var> is beyond the end of <var
- title="">input</var> or if the character at <var
- title="">position</var> is not a U+003A COLON character, then
- fail. Otherwise, move <var title="">position</var> forwards one
- character.</p></li>
-
- <li><p><span>Collect a sequence of characters</span> in the range
- U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
- sequence is not exactly two characters long, then
- fail. Otherwise, interpret the resulting sequence as a base-ten
- integer. Let that number be the <var title="">timezone<sub
- title="">minutes</sub></var>.</p></li>
-
- <li>If <var title="">timezone<sub title="">minutes</sub></var> is
- not a number in the range 0 ≤ <var
- title="">timezone<sub
- title="">minutes</sub></var> ≤ 59, then fail.</li>
-
- <li>If <var title="">sign</var> is "negative", then negate <var
- title="">timezone<sub title="">minutes</sub></var>.</li>
-
- </ol>
-
- <p>Otherwise, fail.</p>
-
- </li>
-
- <li><p>Return <var title="">timezone<sub title="">hours</sub></var>
- and <var title="">timezone<sub
- title="">minutes</sub></var>.</p></li>
-
- </ol>
-
</div>
@@ -5637,28 +5797,487 @@
</div>
- <h5>Vaguer moments in time</h5>
+ <h5>Durations</h5>
- <p>A string is a <dfn>valid date or time string</dfn> if it is also
- one of the following:</p>
+ <p>A <dfn title="concept-duration">duration</dfn> consists of
+ <!--MONTHS: either a number of months or--> a number of seconds.</p>
+ <p class="note">Since months and seconds are not comparable (a month
+ is not a precise number of seconds, but is instead a period whose
+ exact length depends on the precise day from which it is measured) a
+ <span title="concept-duration">duration</span> as defined in this
+ specification cannot <!--MONTHS: consist of a mixture of both-->
+ include months (or years, which are equivalent to twelve months).
+ Only durations that describe a specific number of seconds can be
+ described.</p>
+
+ <p>A string is a <dfn>valid duration string</dfn> representing a
+ <span title="concept-duration">duration</span> <var title="">t</var>
+ if it consists of either of the following:</p>
+
<ul>
- <li>A <span>valid date string</span>.</li>
+ <li>
- <li>A <span>valid time string</span>.</li>
+ <!-- The ISO format -->
- <li>A <span>valid global date and time string</span>.</li>
+ <!-- NOTE: ISO durations also have a number of formats we do not
+ consider conforming:
+ - a "week" format (e.g. P4W). This one is actually supported
+ by the parser.
+
+ - P<date>T<time>, with or without hyphens
+
+ - All these formats, with commas instead of periods for the
+ seconds decimal
+
+ -->
+
+ <p>A literal U+0050 LATIN CAPITAL LETTER P character followed by
+ one or more of the following subcomponents, in the order given,
+ where <!--the number of years, if any, multiplied by twelve, plus
+ the number of months, if any, equals the number of months in <var
+ title="">t</var>, if the duration is in months; or, if it is in
+ seconds, -->the number of days, hours, minutes, and seconds
+ corresponds to the same number of seconds as in <var
+ title="">t</var>:</p>
+
+ <ol>
+<!--MONTHS:
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span> followed by a U+0059
+ LATIN CAPITAL LETTER Y character, representing a number of
+ years.</p></li>
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span> followed by a U+004D
+ LATIN CAPITAL LETTER M character, representing a number of
+ months.</p></li>
+-->
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span> followed by a U+0044
+ LATIN CAPITAL LETTER D character, representing a number of
+ days.</p></li>
+
+ <li>
+
+ <p>A U+0054 LATIN CAPITAL LETTER T character followed by one or
+ more of the following subcomponents, in the order given:</p>
+
+ <ol>
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span> followed by a
+ U+0048 LATIN CAPITAL LETTER H character, representing a number
+ of hours.</p></li>
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span> followed by a
+ U+004D LATIN CAPITAL LETTER M character, representing a number
+ of minutes.</p></li>
+
+ <li>
+
+ <p>The following components:</p>
+
+ <ol>
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span>, representing a
+ number of seconds.</p></li>
+
+ <li><p>Optionally, a U+002E FULL STOP character (.) followed
+ by one or more <span
+ title="concept-datetime-digit">digits</span>, representing a
+ fraction of a second.</p></li>
+
+ <li><p>A U+0053 LATIN CAPITAL LETTER S character.</p></li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ <p class="note">This, as with a number of other date- and
+ time-related microsyntaxes defined in this specification, is based
+ on one of the formats defined in ISO 8601. <a
+ href="#refsISO8601">[ISO8601]</a></p>
+
+ </li>
+
+ <li>
+
+ <p>One or more <span title="duration time component">duration time
+ components</span>, each with a different <span>duration time
+ component scale</span>, in any order; the sum of the represented
+ seconds being equal to the number of seconds in <var
+ title="">t</var>.</p>
+
+ <p>A <dfn>duration time component</dfn> is a string consisting of
+ the following components:</p>
+
+ <ol>
+
+ <li><p>Zero or more <span title="space character">space
+ characters</span>.</p></li>
+
+ <li><p>One or more <span
+ title="concept-datetime-digit">digits</span>, representing a
+ number of time units, scaled by the <span>duration time component
+ scale</span> specified (see below) to represent a number of
+ seconds.</p></li>
+
+ <li><p>If the <span>duration time component scale</span>
+ specified is 1 (i.e. the units are seconds), then, optionally, a
+ U+002E FULL STOP character (.) followed by one or more <span
+ title="concept-datetime-digit">digits</span>, representing a
+ fraction of a second.</p></li>
+
+ <li><p>Zero or more <span title="space character">space
+ characters</span>.</p></li>
+
+ <li>
+
+ <p>One of the following characters, representing the
+ <dfn>duration time component scale</dfn> of the time unit used
+ in the numeric part of the <span>duration time
+ component</span>:</p>
+
+ <dl>
+
+ <dt>U+0057 LATIN CAPITAL LETTER W character</dt>
+ <dt>U+0077 LATIN SMALL LETTER W character</dt>
+
+ <dd>Weeks. The scale is 604800.</dd>
+
+ <dt>U+0044 LATIN CAPITAL LETTER D character</dt>
+ <dt>U+0064 LATIN SMALL LETTER D character</dt>
+
+ <dd>Days. The scale is 86400.</dd>
+
+ <dt>U+0048 LATIN CAPITAL LETTER H character</dt>
+ <dt>U+0068 LATIN SMALL LETTER H character</dt>
+
+ <dd>Hours. The scale is 3600.</dd>
+
+ <dt>U+004D LATIN CAPITAL LETTER M character</dt>
+ <dt>U+006D LATIN SMALL LETTER M character</dt>
+
+ <dd>Minutes. The scale is 60.</dd>
+
+ <dt>U+0053 LATIN CAPITAL LETTER S character</dt>
+ <dt>U+0073 LATIN SMALL LETTER S character</dt>
+
+ <dd>Seconds. The scale is 1.</dd>
+
+ </dl>
+
+ </li>
+
+ <li><p>Zero or more <span title="space character">space
+ characters</span>.</p></li>
+
+ </ol>
+
+ <p class="note">This is not based on any of the formats in ISO
+ 8601. It is intended to be a more human-readable alternative to
+ the ISO 8601 duration format.</p>
+
+ </li>
+
</ul>
- <p>A string is a <dfn>valid date or time string in content</dfn> if
- it consists of zero or more <span>White_Space</span> characters,
- followed by a <span>valid date or time string</span>, followed by
- zero or more further <span>White_Space</span> characters.</p>
+ <div class="impl">
- <hr>
+ <p>The rules to <dfn>parse a duration string</dfn> are as follows.
+ This will return either a <span
+ title="concept-duration">duration</span> or nothing. If at any point
+ the algorithm says that it "fails", this means that it is aborted at
+ that point and returns nothing.</p>
+ <ol>
+
+ <!--MONTHS: this algorithm actually already parses months
+ adequately, though it would need tweaking if we introduced a "mo"
+ unit for the non-ISO variant. See other "MONTHS" annotations below. -->
+
+ <li><p>Let <var title="">input</var> be the string being
+ parsed.</p></li>
+
+ <li><p>Let <var title="">position</var> be a pointer into <var
+ title="">input</var>, initially pointing at the start of the
+ string.</p></li>
+
+ <li><p>Let <var title="">months</var>, <var title="">seconds</var>,
+ and <var title="">component count</var> all be zero.</p></li>
+
+ <li>
+
+ <p>Let <var title="">M-disambiguator</var> be <i>minutes</i>.</p>
+
+ <!--MONTHS: this note would change-->
+ <p class="note">This flag's othe value is <i>months</i>. It is
+ used to disambiguate the "M" unit in ISO8601 durations, which use
+ the same unit for months and minutes. Months are not allowed, but
+ are parsed for future compatibility and to avoid misinterpreting
+ ISO8601 durations that would be valid in other contexts.</p>
+
+ </li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li><p>If <var title="">position</var> is past the end of <var
+ title="">input</var>, then fail.</p></li>
+
+ <li><p>If the character in <var title="">input</var> pointed to by
+ <var title="">position</var> is a U+0050 LATIN CAPITAL LETTER P
+ character, then advance <var title="">position</var> to the next
+ character, set <var title="">M-disambiguator</var> to
+ <i>months</i>, and <span>skip whitespace</span>.</p></li>
+
+ <li>
+
+ <p>Run the following substeps in a loop, until the first step in
+ the loop requires that the loop be broken, or until a step
+ requiring the algorithm to fail is reached:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">units</var> be undefined. It will be
+ assigned one of the following values: <i>years</i>,
+ <i>months</i>, <i>weeks</i>, <i>days</i>, <i>hours</i>,
+ <i>minutes</i>, and <i>seconds</i>.</p></li>
+
+ <li><p>Let <var title="">next character</var> be undefined. It is
+ used to process characters from the <var
+ title="">input</var>.</p></li>
+
+ <li><p>If <var title="">position</var> is past the end of <var
+ title="">input</var>, then break the loop.</p></li>
+
+ <li><p>If the character in <var title="">input</var> pointed to
+ by <var title="">position</var> is a U+0054 LATIN CAPITAL LETTER
+ T character, then advance <var title="">position</var> to the
+ next character, set <var title="">M-disambiguator</var> to
+ <i>minutes</i>, <span>skip whitespace</span>, and return to the
+ top of the loop.</p></li>
+
+ <li><p>Set <var title="">next character</var> to the character in
+ <var title="">input</var> pointed to by <var
+ title="">position</var>.</p></li>
+
+ <li>
+
+ <p>If <var title="">next character</var> is a U+002E FULL STOP
+ character (.), then let <var title="">N</var> equal zero. (Do
+ not advance <var title="">position</var>. That is taken care of
+ below.)</p>
+
+ <p>Otherwise, if <var title="">next character</var> is a
+ character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9), then <span>collect a sequence of characters</span> in
+ the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9),
+ interpret the resulting sequence as a base-ten integer, and let
+ <var title="">N</var> be that number.</p>
+
+ <p>Otherwise <var title="">next character</var> is not part of a
+ number; fail.</p>
+
+ </li>
+
+ <li><p>If <var title="">position</var> is past the end of <var
+ title="">input</var>, then fail.</p></li>
+
+ <li><p>Set <var title="">next character</var> to the character in
+ <var title="">input</var> pointed to by <var
+ title="">position</var>, and this time advance <var
+ title="">position</var> to the next character. (If <var
+ title="">next character</var> was a U+002E FULL STOP character
+ (.) before, it will still be that character this time.)</p></li>
+
+ <li>
+
+ <p>If <var title="">next character</var> is a U+002E FULL STOP
+ character (.), then run these substeps:</p>
+
+ <ol>
+
+ <li><p><span>Collect a sequence of characters</span> in the
+ range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). Let <var
+ title="">s</var> be the resulting sequence.</p></li>
+
+ <li><p>If <var title="">s</var> is the empty string, then
+ fail.</p></li>
+
+ <li><p>Let <var title="">length</var> be the number of
+ characters in <var title="">s</var>.</p></li>
+
+ <li><p>Let <var title="">fraction</var> be the result of
+ interpreting <var title="">s</var> as a base-ten integer, and
+ then dividing that number by <span title="">10<sup
+ title=""><var title="">length</var></sup></span>.</li>
+
+ <li><p>Increment <var title="">N</var> by <var
+ title="">fraction</var>.</p></li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ <li><p>If <var title="">position</var> is past the end of <var
+ title="">input</var>, then fail.</p></li>
+
+ <li><p>Set <var title="">next character</var> to the character
+ in <var title="">input</var> pointed to by <var
+ title="">position</var>, and advance <var
+ title="">position</var> to the next character.</p></li>
+
+ <li><p>If <var title="">next character</var> is neither a
+ U+0053 LATIN CAPITAL LETTER S character nor a U+0073 LATIN
+ SMALL LETTER S character, then fail.</p></li>
+
+ <li><p>Set <var title="">units</var> to <i>seconds</i>.</p></li>
+
+ </ol>
+
+ <p>Otherwise, run these substeps:</p>
+
+ <ol>
+
+ <li><p>If <var title="">next character</var> is a <span>space
+ character</span>, then <span>skip whitespace</span>, set <var
+ title="">next character</var> to the character in <var
+ title="">input</var> pointed to by <var
+ title="">position</var>, and advance <var
+ title="">position</var> to the next character.</p></li>
+
+ <li>
+
+ <!--MONTHS: this would probably be where we would add more
+ logic to support a new unit like 'mo' -->
+
+ <p>If <var title="">next character</var> is a U+0059 LATIN
+ CAPITAL LETTER Y character, or a U+0079 LATIN SMALL LETTER Y
+ character, set <var title="">units</var> to <i>years</i> and
+ set <var title="">M-disambiguator</var> to
+ <i>months</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+004D LATIN
+ CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M
+ character, and <var title="">M-disambiguator</var> is
+ <i>months</i>, then set <var title="">units</var> to
+ <i>months</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+0057 LATIN
+ CAPITAL LETTER W character or a U+0077 LATIN SMALL LETTER W
+ character, set <var title="">units</var> to <i>weeks</i> and
+ set <var title="">M-disambiguator</var> to
+ <i>minutes</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+0044 LATIN
+ CAPITAL LETTER D character or a U+0064 LATIN SMALL LETTER D
+ character, set <var title="">units</var> to <i>days</i> and
+ set <var title="">M-disambiguator</var> to
+ <i>minutes</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+0048 LATIN
+ CAPITAL LETTER H character or a U+0068 LATIN SMALL LETTER H
+ character, set <var title="">units</var> to <i>hours</i> and
+ set <var title="">M-disambiguator</var> to
+ <i>minutes</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+004D LATIN
+ CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M
+ character, and <var title="">M-disambiguator</var> is
+ <i>minutes</i>, then set <var title="">units</var> to
+ <i>minutes</i>.</p>
+
+ <p>If <var title="">next character</var> is a U+0053 LATIN
+ CAPITAL LETTER S character or a U+0073 LATIN SMALL LETTER S
+ character, set <var title="">units</var> to <i>seconds</i> and
+ set <var title="">M-disambiguator</var> to
+ <i>minutes</i>.</p>
+
+ <p>Otherwise if <var title="">next character</var> is none of
+ the above characters, then fail.</p>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Increment <var title="">component count</var>.</p></li>
+
+ <li><p>Let <var title="">multiplier</var> be 1.</p></li>
+
+ <li><p>If <var title="">units</var> is <i>years</i>, multiply
+ <var title="">multiplier</var> by 12 and set <var
+ title="">units</var> to <i>months</i>.</p></li>
+
+ <li>
+
+ <p>If <var title="">units</var> is <i>months</i>, add the
+ product of <var title="">N</var> and <var
+ title="">multiplier</var> to <var
+ title="">months</var>.</p>
+
+ <p>Otherwise, run these substeps:</p>
+
+ <ol>
+
+ <li><p>If <var title="">units</var> is <i>weeks</i>, multiply
+ <var title="">multiplier</var> by 7 and set <var
+ title="">units</var> to <i>days</i>.</p></li>
+
+ <li><p>If <var title="">units</var> is <i>days</i>, multiply
+ <var title="">multiplier</var> by 24 and set <var
+ title="">units</var> to <i>hours</i>.</p></li>
+
+ <li><p>If <var title="">units</var> is <i>hours</i>, multiply
+ <var title="">multiplier</var> by 60 and set <var
+ title="">units</var> to <i>minutes</i>.</p></li>
+
+ <li><p>If <var title="">units</var> is <i>minutes</i>, multiply
+ <var title="">multiplier</var> by 60 and set <var
+ title="">units</var> to <i>seconds</i>.</p></li>
+
+ <li><p>Forcibly, <var title="">units</var> is now
+ <i>seconds</i>. Add the product of <var title="">N</var> and
+ <var title="">multiplier</var> to <var
+ title="">seconds</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p><span>Skip whitespace</span>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>If <var title="">component count</var> is zero,
+ fail.</p></li>
+
+ <!--MONTHS: if we add month support this is where you'd return them-->
+ <li><p>If <var title="">months</var> is not zero, fail.</p></li>
+
+ <li><p>Return the <span title="concept-duration">duration</span>
+ consisting of <var title="">seconds</var> seconds.</p></li>
+
+ </ol>
+
+ </div>
+
+
+ <h5>Vaguer moments in time</h5>
+
<p>A string is a <dfn>valid date string with optional time</dfn> if
it is also one of the following:</p>
@@ -5670,20 +6289,12 @@
</ul>
- <p>A string is a <dfn>valid date string in content with optional
- time</dfn> if it consists of zero or more <span>White_Space</span>
- characters, followed by a <span>valid date string with optional
- time</span>, followed by zero or more further
- <span>White_Space</span> characters.</p>
-
<div class="impl">
<hr>
<p>The rules to <dfn>parse a date or time string</dfn> are as
- follows. The algorithm is invoked with a flag indicating if the
- <i>in attribute</i> variant or the <i>in content</i> variant is to
- be used. The algorithm will return either a <span
+ follows. The algorithm will return either a <span
title="concept-date">date</span>, a <span
title="concept-time">time</span>, a <span
title="concept-datetime">global date and time</span>, or nothing. If
@@ -5699,9 +6310,6 @@
title="">input</var>, initially pointing at the start of the
string.</p></li>
- <li><p>For the <i>in content</i> variant: <span>skip White_Space
- characters</span>.</p></li>
-
<li><p>Set <var title="">start position</var> to the same position
as <var title="">position</var>.</p></li>
@@ -5752,9 +6360,6 @@
title="">timezone<sub title="">minutes</sub></var>. If this returns
nothing, then fail.</p>
- <li><p>For the <i>in content</i> variant: <span>skip White_Space
- characters</span>.</p></li>
-
<li><p>If <var title="">position</var> is <em>not</em> beyond the
end of <var title="">input</var>, then fail.</p></li>
@@ -7632,7 +8237,7 @@
characters that immediately follow the word "<code
title="">charset</code>" (there might not be any).</p></li>
- <li><p>If the next character is not a U+003D EQUALS SIGN ('='),
+ <li><p>If the next character is not a U+003D EQUALS SIGN (=),
then move <var title="">position</var> to point just before that
next character, and jump back to the step labeled
<i>loop</i>.</p></li>
@@ -7647,12 +8252,12 @@
<dl class="switch">
- <dt>If it is a U+0022 QUOTATION MARK ('"') and there is a later U+0022 QUOTATION MARK ('"') in <var title="">s</var></dt>
- <dt>If it is a U+0027 APOSTROPHE ("'") and there is a later U+0027 APOSTROPHE ("'") in <var title="">s</var></dt>
+ <dt>If it is a U+0022 QUOTATION MARK (") and there is a later U+0022 QUOTATION MARK (") in <var title="">s</var></dt>
+ <dt>If it is a U+0027 APOSTROPHE (') and there is a later U+0027 APOSTROPHE (') in <var title="">s</var></dt>
<dd>Return the encoding corresponding to the string between this character and the next earliest occurrence of this character.</dd>
- <dt>If it is an unmatched U+0022 QUOTATION MARK ('"')</dt>
- <dt>If it is an unmatched U+0027 APOSTROPHE ("'")</dt>
+ <dt>If it is an unmatched U+0022 QUOTATION MARK (")</dt>
+ <dt>If it is an unmatched U+0027 APOSTROPHE (')</dt>
<dt>If there is no next character</dt>
<dd>Return nothing.</dd>
@@ -11928,6 +12533,7 @@
<li><code>svg</code></li>
<li><code>table</code></li>
<li><code>textarea</code></li>
+ <li><code>time</code></li>
<li><code>u</code></li>
<li><code>ul</code></li>
<li><code>var</code></li>
@@ -12042,6 +12648,7 @@
<li><code>sup</code></li>
<li><code>svg</code></li>
<li><code>textarea</code></li>
+ <li><code>time</code></li>
<li><code>u</code></li>
<li><code>var</code></li>
<li><code>video</code></li>
@@ -12374,6 +12981,7 @@
<li><code>svg</code></li>
<li><code>table</code></li>
<li><code>textarea</code></li>
+ <li><code>time</code></li>
<li><code>u</code></li>
<li><code>ul</code> (if the element's children include at least one <code>li</code> element)</li>
<li><code>var</code></li>
@@ -15416,9 +16024,9 @@
page.</p></li>
<li><p>If the character in <var title="">input</var> pointed to
- by <var title="">position</var> is a U+003B SEMICOLON ("<code
- title="">;</code>"), then advance <var title="">position</var> to
- the next character. Otherwise, jump to the last step.</p></li>
+ by <var title="">position</var> is a U+003B SEMICOLON (;), then
+ advance <var title="">position</var> to the next character.
+ Otherwise, jump to the last step.</p></li>
<li><p><span>Skip whitespace</span>.</p></li>
@@ -15443,9 +16051,9 @@
<li><p><span>Skip whitespace</span>.</p></li>
<li><p>If the character in <var title="">input</var> pointed to
- by <var title="">position</var> is a U+003D EQUALS SIGN ("<code
- title="">=</code>"), then advance <var title="">position</var> to
- the next character. Otherwise, jump to the last step.</p></li>
+ by <var title="">position</var> is a U+003D EQUALS SIGN (=), then
+ advance <var title="">position</var> to the next character.
+ Otherwise, jump to the last step.</p></li>
<li><p><span>Skip whitespace</span>.</p></li>
@@ -18147,7 +18755,7 @@
<em>...more content...</em>
</div>
<footer>
- <p>Posted <data itemprop="datePublished" value="2009-10-10">Thursday</data>.</p>
+ <p>Posted <time itemprop="datePublished" datetime="2009-10-10">Thursday</time>.</p>
</footer>
</article>
<em>...more blog posts...</em>
@@ -18302,7 +18910,7 @@
<pre><article itemscope itemtype="http://schema.org/BlogPosting">
<header>
<h1 itemprop="headline">The Very First Rule of Life</h1>
- <p><data itemprop="datePublished" value="2009-10-09">3 days ago</data></p>
+ <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
<link itemprop="url" href="?comments=0">
</header>[
<p>If there's a microphone anywhere near you, assume it's hot and
@@ -18318,7 +18926,7 @@
<pre><article itemscope itemtype="http://schema.org/BlogPosting">
<header>
<h1 itemprop="headline">The Very First Rule of Life</h1>
- <p><data itemprop="datePublished" value="2009-10-09">3 days ago</data></p>
+ <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
<link itemprop="url" href="?comments=0">
</header>
<p>If there's a microphone anywhere near you, assume it's hot and
@@ -18332,7 +18940,7 @@
<p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">George Washington</span>
</span></p>
- <p><data itemprop="commentTime" value="2009-10-10">15 minutes ago</data></p>
+ <p><time itemprop="commentTime" datetime="2009-10-10">15 minutes ago</time></p>
</footer>
<p>Yeah! Especially when talking about your lobbyist friends!</p>
</article>
@@ -18342,7 +18950,7 @@
<p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">George Hammond</span>
</span></p>
- <p><data itemprop="commentTime" value="2009-10-10">5 minutes ago</data></p>
+ <p><time itemprop="commentTime" datetime="2009-10-10">5 minutes ago</time></p>
</footer>
<p>Hey, you have the same first name as me.</p>
</article>
@@ -18839,7 +19447,7 @@
<P><A HREF="/fm/015.ogv">Download video</A>.</P>
</VIDEO>
<FOOTER> <!-- footer for article -->
- <P>Published <DATA VALUE="2009-10-21T18:26-07:00">on 2009/10/21 at 6:26pm</DATA></P>
+ <P>Published <TIME DATETIME="2009-10-21T18:26-07:00">on 2009/10/21 at 6:26pm</TIME></P>
</FOOTER>
</ARTICLE>
<ARTICLE>
@@ -18848,7 +19456,7 @@
<P>It is fun to see them pull some coal cars because they look so
dwarfed in comparison.</P>
<FOOTER> <!-- footer for article -->
- <P>Published <DATA VALUE="2009-09-15T14:54-07:00">on 2009/09/15 at 2:54pm</DATA></P>
+ <P>Published <TIME DATETIME="2009-09-15T14:54-07:00">on 2009/09/15 at 2:54pm</TIME></P>
</FOOTER>
</ARTICLE>
<FOOTER> <!-- site wide footer -->
@@ -21901,6 +22509,9 @@
attribute must be present. Its value must be a representation of the
element's contents in a machine-readable format.</p>
+ <p class="note">When the value is date- or time-related, the more
+ specific <code>time</code> element can be used instead.</p>
+
<p>The element can be used for several purposes.</p>
<p>When combined with microformats or the <a
@@ -21929,16 +22540,273 @@
<div class="example">
- <p>The <code>data</code> element can be used to encode dates, for
+ <p>Here, a short table has its numeric values encoded using
+ <code>data</code> so that a script can provide a sorting mechanism
+ on each column, despite the numbers being presented in textual
+ form in one column and in a decomposed form in another.</p>
+
+ <pre><table class="sortable"> <!-- class used by script to find tables to which to add sorting controls -->
+ <thead> <tr> <th> Game <th> Corporations <th> Map Size
+ <tbody>
+ <tr> <td> 1830 <td> <data value="8">Eight</data> <td> <data value="93">19+74 hexes (93 total)</data>
+ <tr> <td> 1856 <td> <data value="11">Eleven</data> <td> <data value="99">12+87 hexes (99 total)</data>
+ <tr> <td> 1870 <td> <data value="10">Ten</data> <td> <data value="149">4+145 hexes (149 total)</data>
+</table></pre>
+
+ </div>
+
+
+
+
+ <h4>The <dfn><code>time</code></dfn> element</h4>
+
+ <dl class="element">
+ <dt>Categories</dt>
+ <dd><span>Flow content</span>.</dd>
+ <dd><span>Phrasing content</span>.</dd>
+ <dd><span>Palpable content</span>.</dd>
+ <dt>Contexts in which this element can be used:</dt>
+ <dd>Where <span>phrasing content</span> is expected.</dd>
+ <dt>Content model:</dt>
+ <dd><span>Phrasing content</span>.</dd>
+ <dt>Content attributes:</dt>
+ <dd><span>Global attributes</span></dd>
+ <dd><code title="attr-time-datetime">datetime</code></dd>
+ <dt>DOM interface:</dt>
+ <dd>
+<pre class="idl">interface <dfn>HTMLTimeElement</dfn> : <span>HTMLElement</span> {
+ attribute DOMString <span title="dom-time-datetime">datetime</span>;
+};</pre>
+ </dd>
+ </dl>
+
+ <p>The <code>time</code> element <span>represents</span> its
+ contents, along with a machine-readable form of those contents in
+ the <code title="attr-time-datetime">datetime</code> attribute. The
+ kind of content is limited to various kinds of dates, times,
+ time-zone offsets, and durations, as described below.</p>
+
+ <p>The <dfn title="attr-time-datetime"><code>datetime</code></dfn>
+ attribute may be present. If present, its value must be a
+ representation of the element's contents in a machine-readable
+ format.</p>
+
+ <p>A <code>time</code> element that does not have a <code
+ title="attr-time-datetime">datetime</code> content attribute must
+ not have any element descendants.</p>
+
+ <p>The <dfn>datetime value</dfn> of a <code>time</code> element is
+ the value of the element's <code
+ title="attr-time-datetime">datetime</code> content attribute, if
+ it has one, or the element's <code>textContent</code>, if it does
+ not.</p>
+
+ <p>The <span>datetime value</span> of a <code>time</code> element
+ must match one of the following syntaxes.</p>
+
+ <dl>
+
+ <dt>A <span>valid month string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>2011-11</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid date string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>2011-11-12</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid yearless date string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>11-12</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid time string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>14:54</time></pre>
+ <pre class="example"><time>14:54:39</time></pre>
+ <pre class="example"><time>14:54:39.92922</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid local date and time string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>2011-11-12T14:54</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39.92922</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid time-zone offset string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>Z</time></pre>
+ <pre class="example"><time>+00:00</time></pre>
+ <pre class="example"><time>-08:00</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid global date and time string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>2011-11-12T14:54Z</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39Z</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39.92922Z</time></pre>
+ <pre class="example"><time>2011-11-12T14:54+00:00</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39+00:00</time></pre>
+ <pre class="example"><time>2011-11-12T14:54:39.92922+00:00</time></pre>
+ <pre class="example"><time>2011-11-12T06:54-08:00</time></pre>
+ <pre class="example"><time>2011-11-12T06:54:39-08:00</time></pre>
+ <pre class="example"><time>2011-11-12T06:54:39.92922-08:00</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid week string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>2011-W46</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid non-negative integer</span> representing a year</dt>
+
+ <dd>
+
+ <pre class="example"><time>2011</time></pre>
+
+ </dd>
+
+
+ <dt>A <span>valid duration string</span></dt>
+
+ <dd>
+
+ <pre class="example"><time>PT4H18M3S</time></pre>
+
+ <pre class="example"><time>4h 18m 3s</time></pre>
+
+ </dd>
+
+ </dl>
+
+ <div class="impl">
+
+ <p>The machine-readable equivalent of the element's contents must be
+ obtained from the element's <span>datetime value</span> by using the
+ following algorithm:</p>
+
+ <ol>
+
+ <li><p>If <span title="parse a month string">parsing a month
+ string</span> from the element's <span>datetime value</span>, if
+ The machine-readable equivalent is the <span
+ title="concept-month">month</span>, that is the machine-readable
+ equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a date string">parsing a date
+ string</span> from the element's <span>datetime value</span>, if
+ The machine-readable equivalent is the <span
+ title="concept-date">date</span>, that is the machine-readable
+ equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a yearless date string">parsing a
+ yearless date string</span> from the element's <span>datetime
+ value</span> returns a <span
+ title="concept-yearless-date">yearless date</span>, that is the
+ machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a time string">parsing a time
+ string</span> from the element's <span>datetime value</span>,
+ returns a <span title="concept-time">time</span>, that is the
+ machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a local date and time string">parsing
+ a local date and time string</span> from the element's
+ <span>datetime value</span> returns a <span
+ title="concept-datetime-local">local date and time</span>, that is
+ the machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a time-zone offset string">parsing a
+ time-zone offset string</span> from the element's <span>datetime
+ value</span>, returns a <span title="concept-timezone">time-zone
+ offset</span>, that is the machine-readable equivalent; abort
+ these steps.</p></li>
+
+ <li><p>If <span title="parse a global date and time
+ string">parsing a global date and time string</span> from the
+ element's <span>datetime value</span> returns a <span
+ title="concept-datetime">global date and time</span>, that is the
+ machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>If <span title="parse a week string">parsing a week
+ string</span> from the element's <span>datetime value</span>,
+ returns a <span title="concept-week">week</span>, that is the
+ machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>If the element's <span>datetime value</span> consists of
+ only characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
+ NINE (9), then the machine-readable equivalent is the base-ten
+ interpretation of those digits, representing a year; abort these
+ steps.</p></li>
+
+ <li><p>If <span title="parse a duration string">parsing a duration
+ string</span> from the element's <span>datetime value</span>,
+ returns a <span title="concept-duration">duration</span>, that is
+ the machine-readable equivalent; abort these steps.</p></li>
+
+ <li><p>There is no machine-readable equivalent.</p></li>
+
+ </ol>
+
+ <p class="note">The algorithms referenced above are intended to be
+ designed such that for any arbitrary string <var title="">s</var>,
+ only one of the algorithms returns a value. A more efficient
+ approach might be to create a single algorithm that parses all these
+ data types in one pass; developing such an algorithm is left as an
+ exercise to the reader.</p>
+
+ <p>The <dfn title="dom-time-datetime"><code>datetime</code></dfn>
+ IDL attribute must <span>reflect</span> the content attribute of the
+ same name.</p>
+
+ </div>
+
+ <div class="example">
+
+ <p>The <code>time</code> element can be used to encode dates, for
example in microformats. The following shows a hypothetical way of
encoding an event using a variant on hCalendar that uses the
- <code>data</code> element:</p>
+ <code>time</code> element:</p>
<pre><div class="vevent">
<a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
<span class="summary">Web 2.0 Conference</span>:
- <data class="dtstart" value="2007-10-05">October 5</data> -
- <data class="dtend" value="2007-10-20">19</data>,
+ <time class="dtstart" datetime="2007-10-05">October 5</time> -
+ <time class="dtend" datetime="2007-10-20">19</time>,
at the <span class="location">Argent Hotel, San Francisco, CA</span>
</div></pre>
@@ -21951,12 +22819,12 @@
<div class="example">
<p>In this example, an article's publication date is marked up
- using <code>data</code> and the schema.org microdata
+ using <code>time</code> and the schema.org microdata
vocabulary:</p>
<pre><article itemscope itemtype="http://schema.org/BlogPosting">
<h1 itemprop="headline">Small tasks</h1>
- <footer>Published <data itemprop="datePublished" value="2009-08-30">yesterday</data>.</footer>
+ <footer>Published <time itemprop="datePublished" datetime="2009-08-30">yesterday</time>.</footer>
<p itemprop="articleBody">I put a bike bell on his bike.</p>
</article></pre>
@@ -21964,43 +22832,46 @@
<div class="example">
- <p>In the following snippet, the <code>data</code> element is used
+ <p>In the following snippet, the <code>time</code> element is used
to encode a date in the ISO8601 format, for later processing by a
script:</p>
- <pre><p>Our first date was <data value="2006-09-23">a Saturday</data>.</p></pre>
+ <pre><p>Our first date was <time datetime="2006-09-23">a Saturday</time>.</p></pre>
<p>In this second snippet, the value includes a time:</p>
- <pre><p>We stopped talking at <data value="2006-09-24T05:00-07:00">5am the next morning</data>.</p></pre>
+ <pre><p>We stopped talking at <time datetime="2006-09-24T05:00-07:00">5am the next morning</time>.</p></pre>
<p>A script loaded by the page (and thus privy to the page's
internal convention of marking up dates and times using the
- <code>data</code> element) could scan through the page and look at
- all the <code>data</code> elements therein to create an index of
+ <code>time</code> element) could scan through the page and look at
+ all the <code>time</code> elements therein to create an index of
dates and times.</p>
</div>
<div class="example">
- <p>Here, a short table has its numeric values encoded using
- <code>data</code> so that a script can provide a sorting mechanism
- on each column, despite the numbers being presented in textual
- form in one column and in a decomposed form in another.</p>
+ <p>For example, this element conveys the string "Tuesday" with
+ the additional semantic that the 12th of November 2011 is the
+ meaning that corresponds to "Tuesday":</p>
- <pre><table class="sortable"> <!-- class used by script to find tables to which to add sorting controls -->
- <thead> <tr> <th> Game <th> Corporations <th> Map Size
- <tbody>
- <tr> <td> 1830 <td> <data value="8">Eight</data> <td> <data value="93">19+74 hexes (93 total)</data>
- <tr> <td> 1856 <td> <data value="11">Eleven</data> <td> <data value="99">12+87 hexes (99 total)</data>
- <tr> <td> 1870 <td> <data value="10">Ten</data> <td> <data value="149">4+145 hexes (149 total)</data>
-</table></pre>
+ <pre>Today is <time datetime="2011-11-12">Tuesday</time>.</pre>
</div>
+ <div class="example">
+ <p>In this example, a specific time in the Pacific Standard Time
+ timezone is specified:</p>
+ <pre>Your next meeting is at <time datetime="2011-11-12T15:00-08:00">3pm</time>.</pre>
+
+ </div>
+
+
+
+
<h4>The <dfn><code>code</code></dfn> element</h4>
<dl class="element">
@@ -23190,6 +24061,11 @@
<td><pre class="example">Available starting today! <strong><data value="UPC:022014640201">North Coast Organic Apple Cider</data></strong></pre>
<tr>
+ <td><code>time</code>
+ <td>Machine-readable equivalent of date- or time-related data
+ <td><pre class="example">Available starting on <strong><time datetime="2011-11-12">November 12th</time></strong>!</pre>
+
+ <tr>
<td><code>code</code>
<td>Computer code
<td><pre class="example">The <strong><code>fruitdb</code></strong> program can be used for tracking fruit production.</pre>
@@ -63882,7 +64758,15 @@
<p>The following extract shows how an IM conversation log could be
marked up, using the <code>data</code> element to provide Unix
- timestamps for each line.</p>
+ timestamps for each line. Note that the timestamps are provided in
+ a format that the <code>time</code> element does not support, so
+ the <code>data</code> element is used instead (namely, Unix <code
+ title="">time_t</code> timestamps). Had the author wished to mark
+ up the data using one of the date and time formats supported by the
+ <code>time</code> element, that element could have been used
+ instead of <code>data</code>. This could be advantageous as it
+ would allow data analysis tools to detect the timestamps
+ unambiguously, without coordination with the page author.</p>
<pre><p> <data value="1319898155">14:22</data> <b>egof</b> I'm not that nerdy, I've only seen 30% of the star trek episodes
<p> <data value="1319898192">14:23</data> <b>kaj</b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
@@ -64772,11 +65656,27 @@
<div class="example">
+ <p>Here, there is an item with a property whose value is a product
+ ID. The ID is not human-friendly, so the product's name is used
+ the human-visible text instead of the ID.</p>
+
+ <pre><h1 itemscope>
+ <data itemprop="product-id" value="9678AOU879">The Instigator 2000</data>
+</h1></pre>
+
+ </div>
+
+ <p>For date- and time-related data, the <code>time</code> element
+ and its <code title="attr-time-datetime">datetime</code> attribute
+ can be used instead.</p>
+
+ <div class="example">
+
<p>In this example, the item has one property, "birthday", whose
value is a date:</p>
<pre><div itemscope>
- I was born on <data itemprop="birthday" value="2009-05-10">May 10th 2009</data>.
+ I was born on <time itemprop="birthday" datetime="2009-05-10">May 10th 2009</time>.
</div></pre>
</div>
@@ -64995,7 +65895,7 @@
<dt>Author
<dd itemprop="author">Peter F. Hamilton
<dt>Publication date
- <dd><data itemprop="pubdate" value="1996-01-26">26 January 1996</data>
+ <dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time>
</dl></pre>
<p>The "<code title="">http://vocab.example.net/book</code>"
@@ -65708,6 +66608,12 @@
the empty string otherwise.</p></dd>
+ <dt>If the element is a <code>time</code> element</dt>
+
+ <dd><p>The value is the element's <span>datetime
+ value</span>.</p></dd>
+
+
<dt>Otherwise</dt>
<dd><p>The value is the element's
@@ -66093,6 +66999,18 @@
title="attr-data-value">value</code> content attribute.</p></dd>
+ <dt>If the element is a <code>time</code> element</dt>
+
+ <dd><p>On getting, if the element has a <code
+ title="attr-time-datetime">datetime</code> content attribute, the
+ IDL attribute must return that content attribute's value;
+ otherwise, it must return the element's <code>textContent</code>.
+ On setting, the IDL attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="attr-time-datetime">datetime</code> content
+ attribute.</p></dd>
+
+
<dt>Otherwise</dt>
<dd><p>The attribute must act the same as the element's
@@ -69140,8 +70058,8 @@
...
<h1 itemprop="summary">Bluesday Tuesday: Money Road</h1>
...
- <data itemprop="dtstart" value="2009-05-05T19:00:00Z">May 5th @ 7pm</data>
- (until <data itemprop="dtend" value="2009-05-05T21:00:00Z">9pm</data>)
+ <time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th @ 7pm</time>
+ (until <time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm</time>)
...
<a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
rel="bookmark" itemprop="url">Link to this page</a>
@@ -69202,8 +70120,8 @@
<pre><div itemscope itemtype="http://microformats.org/profile/hcalendar#vevent">
<p>I'm going to
<strong itemprop="summary">Bluesday Tuesday: Money Road</strong>,
- <data itemprop="dtstart" value="2009-05-05T19:00:00Z">May 5th at 7pm</data>
- to <data itemprop="dtend" value="2009-05-05T21:00:00Z">9pm</data>,
+ <time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th at 7pm</time>
+ to <time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm</time>,
at <span itemprop="location">The RoadHouse</span>!</p>
<p><a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
itemprop="url">See this event on livebrum.co.uk</a>.</p>
@@ -111187,6 +112105,8 @@
<!--END dev-html--><p><i>This section is non-normative.</i></p><!--START dev-html-->
+ <!-- XXX this index doesn't list the palpable elements -->
+
<table>
<caption>List of elements</caption>
<thead>
@@ -112533,6 +113453,18 @@
</tr>
<tr>
+ <th><code>time</code></th>
+ <td>Machine-readable equivalent of date- or time-related data</td>
+ <td><span title="Flow content">flow</span>;
+ <span title="Phrasing content">phrasing</span></td>
+ <td><span title="Phrasing content">phrasing</span></td>
+ <td><span title="Phrasing content">phrasing</span></td>
+ <td><span title="global attributes">globals</span>;
+ <code title="attr-time-datetime">datetime</code></td>
+ <td><code>HTMLTimeElement</code></td>
+ </tr>
+
+ <tr>
<th><code>title</code></th>
<td>Document title</td>
<td><span title="Metadata content">metadata</span></td>
@@ -112760,6 +113692,7 @@
<code>svg</code>;
<code>table</code>;
<code>textarea</code>;
+ <code>time</code>;
<code>u</code>;
<code>ul</code>;
<code>var</code>;
@@ -112843,6 +113776,7 @@
<code>sup</code>;
<code>svg</code>;
<code>textarea</code>;
+ <code>time</code>;
<code>u</code>;
<code>var</code>;
<code>video</code>;
@@ -113040,6 +113974,7 @@
<code>svg</code>;
<code>table</code>;
<code>textarea</code>;
+ <code>time</code>;
<code>u</code>;
<code>var</code>;
<code>video</code>
@@ -113217,6 +114152,20 @@
<td> Date and (optionally) time of the change
<td> <span>Valid date string with optional time</span>
<tr>
+ <th> <code title="">datetime</code>
+ <td> <code title="attr-time-datetime">time</code>
+ <td> Machine-readable value
+ <td> <span>Valid month string</span>,
+ <span>valid date string</span>,
+ <span>valid yearless date string</span>,
+ <span>valid time string</span>,
+ <span>valid local date and time string</span>,
+ <span>valid time-zone offset string</span>,
+ <span>valid global date and time string</span>,
+ <span>valid week string</span>,
+ <span>valid non-negative integer</span>, or
+ <span>valid duration string</span>
+ <tr>
<th> <code title="">default</code>
<td> <code title="attr-track-default">track</code>
<td> Enable the track if no other <span>text track</span> is more suitable.
@@ -113820,12 +114769,6 @@
"<code title="attr-button-type-button">button</code>"
<tr>
<th> <code title="">type</code>
- <td> <code title="attr-button-type">button</code>;
- <code title="attr-input-type">input</code>
- <td> Type of form control
- <td> <span title="attr-input-type"><code>input</code> type keyword</span>
- <tr>
- <th> <code title="">type</code>
<td> <code title="attr-command-type">command</code>
<td> Type of command
<td> "<code title="attr-command-type-keyword-command">command</code>";
@@ -113842,6 +114785,11 @@
<td> <span>Valid MIME type</span>
<tr>
<th> <code title="">type</code>
+ <td> <code title="attr-input-type">input</code>
+ <td> Type of form control
+ <td> <span title="attr-input-type"><code>input</code> type keyword</span>
+ <tr>
+ <th> <code title="">type</code>
<td> <code title="attr-menu-type">menu</code>
<td> Type of menu
<td> "<code title="context menu state">context</code>"; "<code title="toolbar state">toolbar</code>"
@@ -113864,7 +114812,7 @@
<td> <a href="#attribute-text">Text</a>
<tr>
<th> <code title="">value</code>
- <td> <code title="attr-data-value">input</code>
+ <td> <code title="attr-data-value">data</code>
<td> Machine-readable value
<td> <a href="#attribute-text">Text</a>*
<tr>
@@ -114791,6 +115739,10 @@
<td> <code>HTMLTableSectionElement</code> : <code>HTMLElement</code>
<tr>
+ <td> <code>time</code>
+ <td> <code>HTMLTimeElement</code> : <code>HTMLElement</code>
+
+ <tr>
<td> <code>title</code>
<td> <code>HTMLTitleElement</code> : <code>HTMLElement</code>