HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2383[Authors] [Conformance Checkers] [Opera] Define 'month' syntax, and tighten up the rest of the datetime definitions.2008-10-30 01:39
@@ -1951,59 +1951,135 @@
   <em>28</em> otherwise. This takes into account leap years in the
   Gregorian calendar. <a
   href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
   <p>The <dfn title="concept-datetime-digit">digits</dfn> in the date
   and time syntaxes defined in this section must be characters in the
   range U+0030 DIGIT ZERO to U+0039 DIGIT NINE, used to express
   numbers in base ten.</p>
 
 
-  <h5>Dates</h5>
+  <h5>Months</h5>
 
-  <p>A <dfn title="concept-date">date</dfn> consists of a specific
-  Gregorian date with no timezone information, consisting of a year, a
-  month, and a day. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+  <p>A <dfn title="concept-month">month</dfn> consists of a specific
+  Gregorian date with no timezone information and no date information
+  beyond a year and a month. <a
+  href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
-  <p>A string is a <dfn>valid date string</dfn> if it has the
-  components in the following list, in the given order, and if the
-  components in the list follow the constraints given after the
-  list:</p>
+  <p>A string is a <dfn>valid month string</dfn> representing a year
+  <var title="">year</var> and month <var title="">month</var> if it
+  consists of the following components in the given order:</p>
 
   <ol>
 
-   <li>Four or more <span title="concept-datetime-digit">digits</span> (representing the year)</li>
+   <li>Four or more <span
+   title="concept-datetime-digit">digits</span>, representing <var
+   title="">year</var></li>
+
+   <li>A U+002D HYPHEN-MINUS character (-)</li>
 
-   <li>A U+002D HYPHEN-MINUS character (-).</li>
+   <li>Two <span title="concept-datetime-digit">digits</span>,
+   representing the month <var title="">month</var>, in the range
+   0&nbsp;&le;&nbsp;<var
+   title="">month</var>&nbsp;&le;&nbsp;12</li>
 
-   <li>Two <span title="concept-datetime-digit">digits</span> (representing the month)</li>
+  </ol>
 
-   <li>A U+002D HYPHEN-MINUS character (-).</li>
+  <p>The rules to <dfn>parse a month string</dfn> are as follows. This
+  will either return a year and month, 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>
 
-   <li>Two <span title="concept-datetime-digit">digits</span> (representing the day)</li>
+  <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 month component</span> to obtain <var
+   title="">year</var> and <var title="">month</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="">year</var> and <var
+   title="">month</var>.</p></li>
 
   </ol>
 
-  <p>The aforementioned constraints are:</p>
+  <p>The rules to <dfn>parse a month component</dfn>, given an <var
+  title="">input</var> string and a <var title="">position</var>, are
+  as follows. This will either return a year and a month, 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>
 
-  <ul>
+  <ol>
 
-   <li>The month <var title="">m</var> must be in the range
-   0&nbsp;&le;&nbsp;<var title="">m</var>&nbsp;&le;&nbsp;12.</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 at least four characters long, then
+   fail. Otherwise, interpret the resulting sequence as a base-ten
+   integer. Let that number be the <var title="">year</var>.</p></li>
 
-   <li>The day <var title="">d</var> must be in the range
-   0&nbsp;&le;&nbsp;<var title="">d</var>&nbsp;&le;&nbsp;<var
-   title="">D</var> where <var title="">D</var> is the <span
+   <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="">month</var>.</p></li>
+
+   <li>If <var title="">month</var> is not a number in the range
+   1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then
+   fail.</li>
+
+   <li><p>Return <var title="">year</var> and <var
+   title="">month</var>.</p></li>
+
+  </ol>
+
+
+  <h5>Dates</h5>
+
+  <p>A <dfn title="concept-date">date</dfn> consists of a specific
+  Gregorian date with no timezone information, consisting of a year, a
+  month, and a day. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+  <p>A string is a <dfn>valid date string</dfn> representing a year
+  <var title="">year</var>, month <var title="">month</var>, and day
+  <var title="">day</var> if it consists of the following components
+  in the given order:</p>
+
+  <ol>
+
+   <li>A <span>valid month string</span>, representing <var
+   title="">year</var> and <var title="">month</var></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
+   0&nbsp;&le;&nbsp;<var title="">day</var>&nbsp;&le;&nbsp;<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
-   in the given month and year</span>.</li>
+   in the month <var title="">month</var> and year <var
+   title="">year</var></span></li>
 
-  </ul>
+  </ol>
 
   <p>The rules to <dfn>parse a date string</dfn> are as follows. This
   will either return a date, 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>
@@ -2028,41 +2104,23 @@
   </ol>
 
   <p>The rules to <dfn>parse a date component</dfn>, given an <var
   title="">input</var> string and a <var title="">position</var>, are
   as follows. This will either return a year, 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> in the range
-   U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
-   sequence is not at least four characters long, then
-   fail. Otherwise, interpret the resulting sequence as a base-ten
-   integer. Let that number be the <var title="">year</var>.</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="">month</var>.</p></li>
-
-   <li>If <var title="">month</var> is not a number in the range
-   1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then
-   fail.</li>
+   <li><p><span>Parse a month component</span> to obtain <var
+   title="">year</var> and <var title="">month</var>. If this returns
+   nothing, then fail.</li>
 
    <li><p>Let <var title="">maxday</var> be the <span>number of days
    in month <var title="">month</var> of year <var
    title="">year</var></span>.</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>
@@ -2076,83 +2134,77 @@
    <li><p>If <var title="">day</var> is not a number in the range
    1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;<var
    title="">maxday</var>, then fail.</li>
 
    <li><p>Return <var title="">year</var>, <var title="">month</var>,
    and <var title="">day</var>.</p></li>
 
   </ol>
 
 
-
   <h5>Times</h5>
 
   <p>A <dfn title="concept-time">time</dfn> consists of a specific
   time with no timezone information, consisting of an hour, a minute,
   a second, and a fraction of a second.</p>
 
-  <p>A string is a <dfn>valid time string</dfn> if it has the
-  components in the following list, in the given order, and if the
-  components in the list follow the constraints given after the
-  list:</p>
+  <p>A string is a <dfn>valid time string</dfn> representing an hour
+  <var title="">hour</var>, a minute <var title="">minute</var>, and a
+  second <var title="">second</var> if it consists of the following
+  components in the given order:</p>
 
   <ol>
 
-   <li>Two <span title="concept-datetime-digit">digits</span> (representing the hour)</li>
+   <li>Two <span title="concept-datetime-digit">digits</span>,
+   representing <var title="">hour</var>, in the range
+   0&nbsp;&le;&nbsp;<var title="">hour</var>&nbsp;&le;&nbsp;23</li>
 
-   <li>A U+003A COLON character (:).</li>
+   <li>A U+003A COLON character (:)</li>
 
-   <li>Two <span title="concept-datetime-digit">digits</span> (representing the minutes)</li>
+   <li>Two <span title="concept-datetime-digit">digits</span>,
+   representing <var title="">minute</var></li>
 
-   <li>Optionally:
+   <li>Optionally (required if <var title="">second</var> is
+   non-zero):
 
     <ol>
 
-     <li>A U+003A COLON character (:).</li>
+     <li>A U+003A COLON character (:)</li>
 
-     <li>Two <span title="concept-datetime-digit">digits</span> (representing the integer part of the seconds)</li>
+     <li>Two <span title="concept-datetime-digit">digits</span>,
+     representing the integer part of <var title="">second</var>, in
+     the range 0&nbsp;&le;&nbsp;<var
+     title="">s</var>&nbsp;&le;&nbsp;59</li>
 
-     <li>Optionally:
+     <li>Optionally (required if <var title="">second</var> is not an
+     integer):
 
       <ol>
 
        <li>A 002E FULL STOP character (.)</li>
 
-       <li>One or more <span title="concept-datetime-digit">digits</span> (representing the fractional part of the seconds)</li>
+       <li>One or more <span
+       title="concept-datetime-digit">digits</span>, representing the
+       fractional part of <var title="">second</var></li>
 
       </ol>
 
      </li>
 
     </ol>
 
    </li>
 
   </ol>
 
-  <p>The aforementioned constraints are:</p>
-
-  <ul>
-
-   <li>The hour <var title="">h</var> must be in the range
-   0&nbsp;&le;&nbsp;<var title="">h</var>&nbsp;&le;&nbsp;23.</li>
-
-   <li>The minute <var title="">m</var> must be in the range
-   0&nbsp;&le;&nbsp;<var title="">m</var>&nbsp;&le;&nbsp;59.</li>
-
-   <li>If present, the second <var title="">s</var> (consisting of the
-   integer part and its fractional part) must be in the range
-   0&nbsp;&le;&nbsp;<var title="">s</var>&nbsp;&lt;&nbsp;60.  (The
-   values 60 and 61 are not allowed: leap seconds cannot be
-   represented by datetime values.)</li>
-
-  </ul>
+  <p class="note">The <var title="">second</var> component cannot be
+  60 or 61; leap seconds cannot be represented.</p>
 
   <p>The rules to <dfn>parse a time string</dfn> are as follows. This
   will either return a time, 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>
@@ -2261,30 +2313,31 @@
 
 
   <h5>Local dates and times</h5>
 
   <p>A <dfn title="concept-datetime-local">local date and time</dfn>
   consists of a specific 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, but expressed without a time
   zone. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
-  <p>A string is a <dfn>valid local date and time string</dfn> if it
-  has the components in the following list, in the given order:</p>
+  <p>A string is a <dfn>valid 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>.</li>
+   <li>A <span>valid date string</span> representing the date.</li>
 
    <li>A U+0054 LATIN CAPITAL LETTER T character.</li>
 
-   <li>A <span>valid time string</span>.</li>
+   <li>A <span>valid time string</span> representing the time.</li>
 
   </ol>
 
   <p>The rules to <dfn>parse a local date and time string</dfn> are as
   follows. This will either return a date and time, 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>
 
@@ -2334,81 +2387,73 @@
   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,
   consisting of a number of hours and minutes. <a
   href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
   <!--XXX [GREGORIAN] should point to
   <dd id="refsGREGORIAN">[GREGORIAN]</dd>
   <dd>(Non-normative) <cite>Inter Gravissimas</cite>, A. Lilius, C. Clavius. Gregory XIII Papal Bulls, February 1582.</dd>
   -->
 
-  <p>A string is a <dfn>valid global date and time string</dfn> if it
-  has the components in the following list, in the given order, and if
-  the components in the list follow the constraints given after the
-  list:</p>
+  <p>A string is a <dfn>valid global date and time string</dfn>
+  representing a date, time, and a timezone offset if it consists of
+  the following components in the given order:</p>
 
   <ol>
 
-   <li>A <span>valid date string</span>.</li>
+   <li>A <span>valid date string</span> representing the date</li>
 
-   <li>A U+0054 LATIN CAPITAL LETTER T character.</li>
+   <li>A U+0054 LATIN CAPITAL LETTER T character</li>
 
-   <li>A <span>valid time string</span>.</li>
+   <li>A <span>valid time string</span> representing the time</li>
 
    <li>Either:
 
     <ul>
 
-     <li>A U+005A LATIN CAPITAL LETTER Z character (indicating the
-     time zone is UTC)</li>
+     <li>A U+005A LATIN CAPITAL LETTER Z character, allowed only if
+     the time zone is UTC</li>
 
      <li>Or:
 
       <ol>
 
        <li>Either a U+002B PLUS SIGN character (+) or a U+002D
-       HYPHEN-MINUS (-) character (the sign of the timezone
-       offset)</li>
+       HYPHEN-MINUS (-) character, representing the sign of the
+       timezone offset</li>
 
-       <li>Two <span title="concept-datetime-digit">digits</span> (representing the hours component of the timezone offset)</li>
+       <li>Two <span title="concept-datetime-digit">digits</span>,
+       representing the hours component <var title="">hour</var> of
+       the timezone offset, in the range 0&nbsp;&le;&nbsp;<var
+       title="">hour</var>&nbsp;&le;&nbsp;23</li>
 
-       <li>A U+003A COLON character (:).</li>
+       <li>A U+003A COLON character (:)</li>
 
-       <li>Two <span title="concept-datetime-digit">digits</span> (representing the minutes component of the timezone offset)</li>
+       <li>Two <span title="concept-datetime-digit">digits</span>,
+       representing the minutes component <var title="">minute</var>
+       of the timezone offset, in the range 0&nbsp;&le;&nbsp;<var
+       title="">minute</var>&nbsp;&le;&nbsp;59</li>
 
       </ol>
 
      </li>
 
     </ul>
 
    </li>
 
   </ol>
 
-  <p>The aforementioned constraints are:</p>
-
-  <ul>
-
-   <li>If present, the time zone hour <var title="">h</var> must be in
-   the range 0&nbsp;&le;&nbsp;<var
-   title="">h</var>&nbsp;&le;&nbsp;23. (However, in practice, time
-   zones do not currently ever have an hour component greater than
-   14.)</li>
-
-   <li>If present, the time zone minute <var title="">m</var> must be
-   in the range 0&nbsp;&le;&nbsp;<var
-   title="">m</var>&nbsp;&le;&nbsp;59. (However, in practice, time
-   zones do not currently ever have a minute component other than 0, 30,
-   or 45.)</li>
-
-  </ul>
+  <p class="note">This format allows for time zone offsets from -23:59
+  to +23:59. In practice, however, the range of actual time zones is
+  -12:00 to +14:00, and the minutes component of actual time zones is
+  always either 00, 30, or 45.</p>
 
   <div class="example">
 
    <p>The following are some examples of dates written as <span
    title="valid global date and time string">valid global date and
    time strings</span>.</p>
 
    <dl>
 
     <dt>"<code>0037-12-13T00:00Z</code>"</dt>
@@ -2579,33 +2624,20 @@
    title="">timezone<sub title="">hours</sub></var> hours and <var
    title="">timezone<sub title="">minutes</sub></var> minutes from
    UTC.</p></li>
 
    <li><p>Return <var title="">time</var> and <var
    title="">timezone</var>.</p></li>
 
   </ol>
 
 
-
-  <h5>Months</h5>
-
-  <p>A <dfn title="concept-month">month</dfn> consists of a specific
-  Gregorian date with no timezone information and no date information
-  beyond a year and a month. <a
-  href="#refsGREGORIAN">[GREGORIAN]</a></p>
-
-  <p class="XXX">... <dfn>valid month string</dfn></p>
-
-  <p class="XXX">... rules to <dfn>parse a month string</dfn></p>
-
-
   <h5>Weeks</h5>
 
   <p>A <dfn title="concept-week">week</dfn> consists of a specific
   Gregorian date with no timezone information and no date information
   beyond a year and a week. <a
   href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
   <!-- XXX ISO week information -->
 
   <p class="XXX">... <dfn>valid week string</dfn></p>

|