HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6845

SVNBugCommentTime (UTC)
6845[Authors] [Conformance Checkers] [Gecko] [Internet Explorer] [Opera] [Webkit] [Tools] Update the date-and-time microsyntaxes to support having the 'T' replaced by a single space. (Note: multiple spaces are invalid and will cause parse failures. Only a single space is supported.) Based on proposal and implementation evidence from Tantek documented at http://wiki.whatwg.org/wiki/Time_element#permit_space_instead_of_T_in_datetimes2011-12-06 23:00
Index: source
===================================================================
--- source	(revision 6844)
+++ source	(revision 6845)
@@ -5271,14 +5271,28 @@
 
   <ol>
 
-   <li>A <span>valid date string</span> representing the date.</li>
+   <li>A <span>valid date string</span> representing the date</li>
 
-   <li>A U+0054 LATIN CAPITAL LETTER T character (T).</li>
+   <li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character</li>
 
-   <li>A <span>valid time string</span> representing the time.</li>
+   <li>A <span>valid time string</span> representing the time</li>
 
   </ol>
 
+  <p>A string is a <dfn>valid normalized local date and time
+  string</dfn> representing a date and time 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, expressed as the shortest possible string for the given time (e.g. omitting the seconds component entirely if the given time is zero seconds past the minute)</li>
+
+  </ol>
+
   <div class="impl">
 
   <p>The rules to <dfn>parse a local date and time string</dfn> are as
@@ -5301,9 +5315,9 @@
 
    <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+0054 LATIN CAPITAL LETTER T
-   character (T) then fail. Otherwise, move <var
-   title="">position</var> forwards one character.</p></li>
+   title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T
+   character (T) nor a U+0020 SPACE character, then fail. Otherwise,
+   move <var title="">position</var> forwards one character.</p></li>
 
    <li><p><span>Parse a time component</span> to obtain <var
    title="">hour</var>, <var title="">minute</var>, and <var
@@ -5552,7 +5566,7 @@
 
    <li>A <span>valid date string</span> representing the date</li>
 
-   <li>A U+0054 LATIN CAPITAL LETTER T character (T)</li>
+   <li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character</li>
 
    <li>A <span>valid time string</span> representing the time</li>
 
@@ -5577,7 +5591,7 @@
 
    <dl>
 
-    <dt>"<code>0037-12-13T00:00Z</code>"</dt>
+    <dt>"<code>0037-12-13 00:00Z</code>"</dt>
 
     <dd>Midnight in areas using London time on the birthday of Nero
     (the Roman Emperor). See below for further discussion on which
@@ -5605,6 +5619,11 @@
     <li>Years with fewer than four digits have to be
     zero-padded. The date "37-12-13" would not be a valid date.</li>
 
+    <li>If the "<code title="">T</code>" is replaced by a space, it
+    must be a single space character. The string "<code
+    title="">2001-12-21&nbsp;&nbsp;12:00Z</code>" (with two spaces
+    between the components) would not be parsed successfully.</li>
+
     <li>To unambiguously identify a moment in time prior to the
     introduction of the Gregorian calendar (insofar as moments in time
     before the formation of UTC can be unambiguously identified), the
@@ -5633,7 +5652,7 @@
 
   </div>
 
-  <p>A string is a <dfn>valid forced-UTC global date and time
+  <p>A string is a <dfn>valid normalized forced-UTC 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>
 
@@ -5651,16 +5670,6 @@
 
   <div class="impl">
 
-  <p>The <dfn>best representation of the global date and time
-  string</dfn> <var title="">datetime</var> is the <span>valid global
-  date and time string</span> representing <var
-  title="">datetime</var>, with the <span>valid time string</span>
-  component being given in its shortest possible form, with the last
-  character of the string not being a U+005A LATIN CAPITAL LETTER Z
-  character (Z), even if the time zone is UTC, and with a U+002B PLUS
-  SIGN character (+) representing the sign of the time-zone offset
-  when the time zone is UTC.</p>
-
   <p>The rules to <dfn>parse a global date and time string</dfn> are
   as follows. This will return either a time in UTC, with associated
   time-zone offset information for round-tripping or display purposes,
@@ -5682,9 +5691,9 @@
 
    <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+0054 LATIN CAPITAL LETTER T
-   character (T) then fail. Otherwise, move <var
-   title="">position</var> forwards one character.</p></li>
+   title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T
+   character (T) nor a U+0020 SPACE character, then fail. Otherwise,
+   move <var title="">position</var> forwards one character.</p></li>
 
    <li><p><span>Parse a time component</span> to obtain <var
    title="">hour</var>, <var title="">minute</var>, and <var
@@ -6326,9 +6335,9 @@
 
   <ul>
 
-   <li>A <span>valid date string</span>.</li>
+   <li>A <span>valid date string</span></li>
 
-   <li>A <span>valid global date and time string</span>.</li>
+   <li>A <span>valid global date and time string</span></li>
 
   </ul>
 
@@ -6369,16 +6378,17 @@
     <p>If <var title="">date present</var> is true, and <var
     title="">position</var> is not beyond the end of <var
     title="">input</var>, and the character at <var
-    title="">position</var> is a U+0054 LATIN CAPITAL LETTER T
-    character (T), then advance <var title="">position</var> to the
-    next character in <var title="">input</var>.</p>
+    title="">position</var> is either a U+0054 LATIN CAPITAL LETTER T
+    character (T) or a U+0020 SPACE character, then advance <var
+    title="">position</var> to the next character in <var
+    title="">input</var>.</p>
 
     <p>Otherwise, if <var title="">date present</var> is true, and
     either <var title="">position</var> is beyond the end of <var
     title="">input</var> or the character at <var
-    title="">position</var> is not a U+0054 LATIN CAPITAL LETTER T
-    character (T), then set <var title="">time present</var> to
-    false.</p>
+    title="">position</var> is neither a U+0054 LATIN CAPITAL LETTER T
+    character (T) nor a U+0020 SPACE character, then set <var
+    title="">time present</var> to false.</p>
 
     <p>Otherwise, if <var title="">date present</var> is false, set
     <var title="">position</var> back to the same position as <var
@@ -22714,6 +22724,9 @@
     <pre class="example">&lt;time>2011-11-12T14:54&lt;/time></pre>
     <pre class="example">&lt;time>2011-11-12T14:54:39&lt;/time></pre>
     <pre class="example">&lt;time>2011-11-12T14:54:39.92922&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39.92922&lt;/time></pre>
 
    </dd>
 
@@ -22755,6 +22768,26 @@
     <pre class="example">&lt;time>2011-11-12T06:54:39-08:00&lt;/time></pre>
     <pre class="example">&lt;time>2011-11-12T06:54:39.92922-08:00&lt;/time></pre>
 
+    <pre class="example">&lt;time>2011-11-12 14:54Z&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39Z&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39.92922Z&lt;/time></pre>
+
+    <pre class="example">&lt;time>2011-11-12 14:54+0000&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39+0000&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39.92922+0000&lt;/time></pre> 
+
+    <pre class="example">&lt;time>2011-11-12 14:54+00:00&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39+00:00&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 14:54:39.92922+00:00&lt;/time></pre>
+
+    <pre class="example">&lt;time>2011-11-12 06:54-0800&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 06:54:39-0800&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 06:54:39.92922-0800&lt;/time></pre>
+
+    <pre class="example">&lt;time>2011-11-12 06:54-08:00&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 06:54:39-08:00&lt;/time></pre>
+    <pre class="example">&lt;time>2011-11-12 06:54:39.92922-08:00&lt;/time></pre>
+
    </dd>
 
 
@@ -24301,11 +24334,11 @@
 
    <pre class="bad">&lt;aside>
  &lt;!-- don't do this -->
- &lt;ins datetime="2005-03-16T00:00Z">
+ &lt;ins datetime="2005-03-16 00:00Z">
   &lt;p> I like fruit. &lt;/p>
   Apples are &lt;em>tasty&lt;/em>.
  &lt;/ins>
- &lt;ins datetime="2007-12-19T00:00Z">
+ &lt;ins datetime="2007-12-19 00:00Z">
   So are pears.
  &lt;/ins>
 &lt;/aside></pre>
@@ -24314,13 +24347,13 @@
    but none of the elements cross implied paragraph boundaries.</p>
 
    <pre>&lt;aside>
- &lt;ins datetime="2005-03-16T00:00Z">
+ &lt;ins datetime="2005-03-16 00:00Z">
   &lt;p> I like fruit. &lt;/p>
  &lt;/ins>
- &lt;ins datetime="2005-03-16T00:00Z">
+ &lt;ins datetime="2005-03-16 00:00Z">
   Apples are &lt;em>tasty&lt;/em>.
  &lt;/ins>
- &lt;ins datetime="2007-12-19T00:00Z">
+ &lt;ins datetime="2007-12-19 00:00Z">
   So are pears.
  &lt;/ins>
 &lt;/aside></pre>
@@ -24589,11 +24622,11 @@
 
    <pre>&lt;table>
  &lt;thead>
-  &lt;tr> &lt;th> Game name           &lt;th> Game publisher   &lt;th> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02T14:23Z">Verdict&lt;/del></strong>
+  &lt;tr> &lt;th> Game name           &lt;th> Game publisher   &lt;th> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">Verdict&lt;/del></strong>
  &lt;tbody>
-  &lt;tr> &lt;td> Diablo 2            &lt;td> Blizzard         &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02T14:23Z">8/10&lt;/del></strong>
-  &lt;tr> &lt;td> Portal              &lt;td> Valve            &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02T14:23Z">10/10&lt;/del></strong>
-  &lt;tr> &lt;td> Portal 2            &lt;td> Valve            &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02T14:23Z">10/10&lt;/del></strong>
+  &lt;tr> &lt;td> Diablo 2            &lt;td> Blizzard         &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">8/10&lt;/del></strong>
+  &lt;tr> &lt;td> Portal              &lt;td> Valve            &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10&lt;/del></strong>
+  &lt;tr> &lt;td> Portal 2            &lt;td> Valve            &lt;td> <strong>&lt;del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10&lt;/del></strong>
 &lt;/table></pre>
 
   </div>
@@ -51612,7 +51645,7 @@
   <span title="parse a global date and time string">parsing a global
   date and time</span> from it. User agents must not allow the user to
   set the <span title="concept-fe-value">value</span> to a non-empty
-  string that is not a <span>valid forced-UTC global date and time
+  string that is not a <span>valid normalized forced-UTC global date and time
   string</span>, though user agents may allow the user to set and view
   the time in another time zone and silently translate the time to and
   from the UTC time zone in the <span
@@ -51620,7 +51653,7 @@
   user interface for selecting a <span title="concept-datetime">global
   date and time</span>, then the <span
   title="concept-fe-value">value</span> must be set to a <span>valid
-  forced-UTC global date and time string</span> representing the
+  normalized forced-UTC global date and time string</span> representing the
   user's selection. User agents should allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string.</p>
 
@@ -51644,9 +51677,9 @@
   of the element is a <span>valid global date and time string</span>,
   then adjust the time so that the <span
   title="concept-fe-value">value</span> represents the same point in
-  time but expressed in the UTC time zone as a <span>valid forced-UTC
-  global date and time string</span>, otherwise, set it to the empty
-  string instead.</p>
+  time but expressed in the UTC time zone as a <span>valid normalized
+  forced-UTC global date and time string</span>, otherwise, set it to
+  the empty string instead.</p>
 
   </div>
 
@@ -51688,8 +51721,8 @@
   <p><strong>The <span
   title="concept-input-value-number-string">algorithm to convert a
   number to a string</span>, given a number <var title="">input</var>,
-  is as follows</strong>: Return a <span>valid global date and time
-  string</span> expressed in UTC that represents the <span
+  is as follows</strong>: Return a <span>valid normalized forced-UTC
+  global date and time string</span> that represents the <span
   title="concept-datetime">global date and time</span> that is <var
   title="">input</var> milliseconds after midnight UTC on the morning
   of 1970-01-01 (the time represented by the value "<code
@@ -51709,8 +51742,8 @@
   title="concept-input-value-date-string">algorithm to convert a
   <code>Date</code> object to a string</span>, given a
   <code>Date</code> object <var title="">input</var>, is as
-  follows</strong>: Return a <span>valid global date and time
-  string</span> expressed in UTC that represents the <span
+  follows</strong>: Return a <span>valid normalized forced-UTC global
+  date and time string</span> that represents the <span
   title="concept-datetime">global date and time</span> that is
   represented by <var title="">input</var>.</p>
 
@@ -52553,12 +52586,13 @@
   <span title="parse a local date and time string">parsing a date and
   time</span> from it. User agents must not allow the user to set the
   <span title="concept-fe-value">value</span> to a non-empty string
-  that is not a <span>valid local date and time string</span>. If the
-  user agent provides a user interface for selecting a <span
-  title="concept-datetime-local">local date and time</span>, then the
-  <span title="concept-fe-value">value</span> must be set to a
-  <span>valid local date and time string</span> representing the
-  user's selection. User agents should allow the user to set the <span
+  that is not a <span>valid normalized local date and time
+  string</span>. If the user agent provides a user interface for
+  selecting a <span title="concept-datetime-local">local date and
+  time</span>, then the <span title="concept-fe-value">value</span>
+  must be set to a <span>valid normalized local date and time
+  string</span> representing the user's selection. User agents should
+  allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string.</p>
 
   </div>
@@ -52577,8 +52611,10 @@
 
   <p><strong>The <span>value sanitization algorithm</span> is as
   follows</strong>: If the <span title="concept-fe-value">value</span>
-  of the element is not a <span>valid local date and time
-  string</span>, then set it to the empty string instead.</p>
+  of the element is a <span>valid local date and time string</span>,
+  then set it to a <span>valid normalized local date and time
+  string</span> representing the same date and time; otherwise, set it
+  to the empty string instead.</p>
 
   </div>
 
@@ -52620,10 +52656,10 @@
   <p><strong>The <span
   title="concept-input-value-number-string">algorithm to convert a
   number to a string</span>, given a number <var title="">input</var>,
-  is as follows</strong>: Return a <span>valid local date and time
-  string</span> that represents the date and time that is <var
-  title="">input</var> milliseconds after midnight on the morning of
-  1970-01-01 (the time represented by the value "<code
+  is as follows</strong>: Return a <span>valid normalized local date
+  and time string</span> that represents the date and time that is
+  <var title="">input</var> milliseconds after midnight on the morning
+  of 1970-01-01 (the time represented by the value "<code
   title="">1970-01-01T00:00:00.0</code>").</p>
 
   </div>
@@ -69270,8 +69306,8 @@
    &lt;meta itemprop="type" content="cell">mobile phone&lt;/span>
   &lt;/li>
  &lt;/ul>
- &lt;ins datetime="2008-07-20T21:00:00+01:00">
-  &lt;meta itemprop="rev" content="2008-07-20T21:00:00+01:00">
+ &lt;ins datetime="2008-07-20 21:00:00+01:00">
+  &lt;meta itemprop="rev" content="2008-07-20 21:00:00+01:00">
   &lt;p itemprop="tel" itemscope>&lt;strong>Update!&lt;/strong>
   My new &lt;span itemprop="type">home&lt;/span> phone number is
   &lt;span itemprop="value">01632 960 123&lt;/span>.&lt;/p>

|