Skip to content
Browse files

[] (0) WF2: Restructure the way dates and times are specified.

git-svn-id: http://svn.whatwg.org/webapps@2251 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent c1d4af4 commit b40fe61a31c3cd66766ec30f8416c7f8f3e6fb6b @Hixie Hixie committed
Showing with 615 additions and 435 deletions.
  1. +453 −360 index
  2. +162 −75 source
View
813 index
453 additions, 360 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
237 source
@@ -1941,6 +1941,13 @@
<h5>Specific moments in time</h5>
+ <p class="big-issue">This syntax is going to be tightened up and
+ made almost exactly the same as the <span>valid UTC date and time
+ string</span> syntax, with the exception of allowing time zones. In
+ fact what we might do is allow time zones in general, use the same
+ parser, etc, but require that UAs always use the UTC time zone when
+ synthesizing datetimes for form submission.</p>
+
<p>A string is a <dfn>valid datetime</dfn> if it has four digits
(representing the year), a literal hyphen, two digits (representing
the month), a literal hyphen, two digits (representing the day),
@@ -2618,22 +2625,87 @@
<h5>UTC dates and times</h5>
- <p>A <dfn>UTC date and time</dfn> consists of a specific Gregorian
- date expressed relative to the UTC timezone, consisting of a year, a
- month, a day, an hour, a minute, a second, and a fraction of a
- second. <a href="#refsGREGORIAN">[GREGORIAN]</a></p>
+ <p>A <dfn title="concept-datetime">UTC date and time</dfn> consists
+ of a specific Gregorian date expressed relative to the UTC timezone,
+ consisting of a year, a month, a day, an hour, a minute, a second,
+ and a fraction of a second. <a
+ href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p class="big-issue">... <dfn>valid UTC date and time string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a UTC date and time
+ string</dfn></p>
+
+
+ <h5>Local dates and times</h5>
+
+ <p>A <dfn title="concept-datetime-local">local date and time</dfn>
+ consists of a specific Gregorian date with no timezone information,
+ consisting of a year, a month, a day, an hour, a minute, a second,
+ and a fraction of a second. <a
+ href="#refsGREGORIAN">[GREGORIAN]</a></p>
+
+ <p class="big-issue">... <dfn>valid local date and time string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a local date and time
+ string</dfn></p>
+
+
+ <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 class="big-issue">... <dfn>valid date string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a date string</dfn></p>
+
+
+ <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="big-issue">... <dfn>valid month string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a month string</dfn></p>
+
- <p class="big-issue">... <dfn>valid UTC date and time</dfn></p>
+ <h5>Weeks</h5>
- <p class="big-issue">... rules to <dfn>parse a UTC date and time</dfn></p>
+ <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="big-issue">... <dfn>valid week string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a week string</dfn></p>
+
+
+ <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 class="big-issue">... <dfn>valid time string</dfn></p>
+
+ <p class="big-issue">... rules to <dfn>parse a time string</dfn></p>
<h5>Time offsets</h5>
<p class="big-issue"><dfn>valid time offset</dfn>, <dfn>rules for
parsing time offsets</dfn>, <dfn>time offset serialization
- rules</dfn>; in the format "5d4h3m2s1ms" or "3m 9.2s" or "00:00:00.00"
- or similar.</p>
+ rules</dfn>; probably in the format "5d4h3m2.1s" or similar, with
+ all components being optional, and the last component's unit suffix
+ being optional if it's in seconds.</p>
@@ -9634,9 +9706,9 @@ people expect to have work and what is necessary.
<pre>&lt;script src="game-engine.js">&lt;/script>
&lt;script type="text/x-game-map">
........U.........e
-o............x....e
-.....x.....xxx....e
-.x..xxx...xxxxx...e
+o............A....e
+.....A.....AAA....e
+.A..AAA...AAAAA...e
&lt;/script></pre>
<p>The data in this case might be used by the script to generate
@@ -14166,7 +14238,7 @@ brighter. A &lt;b>rat&lt;/b> scurries past the corner wall.&lt;/p></pre>
&lt;/ins>
&lt;/aside></pre>
- <!-- Those date's aren't random. They're the start and end of
+ <!-- Those dates aren't random. They're the start and end of
something. Can you guess what? -->
</div>
@@ -26264,6 +26336,11 @@ function AddCloud(data, x, y) { ... }</pre>
<h5>States of the <code title="attr-input-type">type</code> attribute</h5>
+ <!-- XXX for things that say "express it as a valid foo", make sure
+ that valid foo is unambiguous, and if not, define a canonical
+ serialisation. e.g. should it be 2008-01-01T00:00 or
+ 2008-01-01t00:00? should it be 1e2 or 100? -->
+
<h6><dfn title="attr-input-type-text">Text</dfn> state</h6>
<p>When an <code>input</code> element's <code
@@ -26522,33 +26599,35 @@ function AddCloud(data, x, y) { ... }</pre>
<p>The <code>input</code> element represents a control for setting
the element's <span title="concept-fe-value">value</span> to a
- string representing a specific <span>UTC date and time</span>. User
- agents may display the date and time in whatever timezone is
- appropriate for the user.</p>
+ string representing a specific <span title="concept-datetime">UTC
+ date and time</span>. User agents may display the date and time in
+ whatever timezone is appropriate for the user.</p>
<p>If the element is <i title="concept-input-mutable">mutable</i>,
- the user should allow the user to change the date and time
- represented by its <span title="concept-fe-value">value</span>, as
- obtained by <span title="parse a UTC date and time">parsing a UTC
- 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 string that
- is not a <span>valid UTC date and time</span>. If the user agent
- provides a user interface for selecting a date and time, then the
- <span title="concept-fe-value">value</span> must be set to a
- <span>valid UTC date and time</span> representing the user's
+ the user should allow the user to change the <span
+ title="concept-datetime">UTC date and time</span> represented by its
+ <span title="concept-fe-value">value</span>, as obtained by <span
+ title="parse a UTC date and time string">parsing a UTC 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 string that is not
+ a <span>valid UTC date and time string</span>. If the user agent
+ provides a user interface for selecting a <span
+ title="concept-datetime">UTC date and time</span>, then the <span
+ title="concept-fe-value">value</span> must be set to a <span>valid
+ UTC 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>
<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 UTC date and time</span>, then
- set it to the empty string instead.</p>
+ of the element is not a <span>valid UTC date and time string</span>,
+ then set it to the empty string instead.</p>
<p>The <code title="attr-input-min">min</code> attribute, if
- specified, must have a value that is a <span>valid UTC date and
- time</span>. The <code title="attr-input-max">max</code> attribute,
- if specified, must have a value that is a <span>valid UTC date and
- time</span>.</p>
+ specified, must have a value that is a <span>valid UTC date and time
+ string</span>. The <code title="attr-input-max">max</code>
+ attribute, if specified, must have a value that is a <span>valid UTC
+ date and time string</span>.</p>
<p>The <code title="attr-input-step">step</code> attribute is
expressed in seconds. The <span
@@ -26559,26 +26638,29 @@ function AddCloud(data, x, y) { ... }</pre>
<p>When the element is <span>suffering from a step mismatch</span>,
the user agent may round the element's <span
- title="concept-input-value">value</span> to the nearest date and
- time for which the element would not <span title="suffering from a
- step mismatch">suffer from a step mismatch</span>.</p>
+ title="concept-input-value">value</span> to the nearest <span
+ title="concept-datetime">UTC date and time</span> for which the
+ element would not <span title="suffering from a step
+ mismatch">suffer from a step mismatch</span>.</p>
<p><strong>The <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span>, given a string <var title="">input</var>,
- is as follows:</strong> If <span title="parse a UTC date and
- time">parsing a UTC date and time</span> from <var
+ is as follows:</strong> If <span title="parse a UTC date and time
+ string">parsing a UTC date and time</span> from <var
title="">input</var> results in an error, then return an error;
otherwise, return the number of milliseconds elapsed from midnight
UTC on the morning of 1970-01-01 (the time represented by the value
- "<code title="">1970-01-01T00:00:00.0Z</code>") to the parsed date
- and time, ignoring leap seconds.</p>
+ "<code title="">1970-01-01T00:00:00.0Z</code>") to the parsed <span
+ title="concept-datetime">UTC date and time</span>, ignoring leap
+ seconds.</p>
<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 UTC date and
- time</span> that represents the date and time in UTC that is <var
+ is as follows:</strong> Return a <span>valid UTC date and time
+ string</span> that represents the <span
+ title="concept-datetime">date and time in UTC</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
title="">1970-01-01T00:00:00.0Z</code>").</p>
@@ -26587,18 +26669,19 @@ function AddCloud(data, x, y) { ... }</pre>
title="concept-input-value-string-date">algorithm to convert a
string to a <code>Date</code> object</span>, given a string <var
title="">input</var>, is as follows:</strong> If <span title="parse
- a UTC date and time">parsing a UTC date and time</span> from <var
- title="">input</var> results in an error, then return an error;
+ a UTC date and time string">parsing a UTC date and time</span> from
+ <var title="">input</var> results in an error, then return an error;
otherwise, return a <code>Date</code> object representing the parsed
- date and time.</p>
+ <span title="concept-datetime">UTC date and time</span>.</p>
<p><strong>The <span
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 UTC date and time</span> that
- represents the date and time in UTC that is represented by <var
- title="">input</var>.</p>
+ follows:</strong> Return a <span>valid UTC date and time
+ string</span> that represents the <span
+ title="concept-datetime">date and time in UTC</span> that is
+ represented by <var title="">input</var>.</p>
<p>The following common <code>input</code> element content
attributes, DOM attributes, and methods apply to the element:
@@ -26689,32 +26772,34 @@ function AddCloud(data, x, y) { ... }</pre>
<p>The <code>input</code> element represents a control for setting
the element's <span title="concept-fe-value">value</span> to a
- string representing a <span>date and time</span>, with no time zone
- information.</p>
+ string representing a <span title="concept-datetime-local">local
+ date and time</span>, with no time zone information.</p>
<p>If the element is <i title="concept-input-mutable">mutable</i>,
- the user should allow the user to change the date and time
- represented by its <span title="concept-fe-value">value</span>, as
- obtained by <span title="parse a date and time">parsing a date and
+ the user should allow the user to change the <span
+ title="concept-datetime-local">date and time</span> represented by
+ its <span title="concept-fe-value">value</span>, as obtained by
+ <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 string that is not
- a <span>valid date and time</span>. If the user agent provides a
- user interface for selecting a date and time, then the <span
- title="concept-fe-value">value</span> must be set to a <span>valid
- date and time</span> representing the user's selection. User agents
- should allow the user to set the <span
+ 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
title="concept-fe-value">value</span> to the empty string.</p>
<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 date and time</span>, then set
- it to the empty string instead.</p>
+ of the element is not a <span>valid local date and time
+ string</span>, then set it to the empty string instead.</p>
<p>The <code title="attr-input-min">min</code> attribute, if
- specified, must have a value that is a <span>valid date and
- time</span>. The <code title="attr-input-max">max</code> attribute,
- if specified, must have a value that is a <span>valid date and
- time</span>.</p>
+ specified, must have a value that is a <span>valid local date and
+ time string</span>. The <code title="attr-input-max">max</code>
+ attribute, if specified, must have a value that is a <span>valid
+ local date and time string</span>.</p>
<p>The <code title="attr-input-step">step</code> attribute is
expressed in seconds. The <span
@@ -26725,28 +26810,30 @@ function AddCloud(data, x, y) { ... }</pre>
<p>When the element is <span>suffering from a step mismatch</span>,
the user agent may round the element's <span
- title="concept-input-value">value</span> to the nearest date and
- time for which the element would not <span title="suffering from a
- step mismatch">suffer from a step mismatch</span>.</p>
+ title="concept-input-value">value</span> to the nearest <span
+ title="concept-datetime-local">local date and time</span> for which
+ the element would not <span title="suffering from a step
+ mismatch">suffer from a step mismatch</span>.</p>
<p><strong>The <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span>, given a string <var title="">input</var>,
- is as follows:</strong> If <span title="parse a date and
- time">parsing a date and time</span> from <var title="">input</var>
- results in an error, then return an error; otherwise, return the
- number of milliseconds elapsed from midnight on the morning of
- 1970-01-01 (the time represented by the value "<code
- title="">1970-01-01T00:00:00.0</code>") to the parsed date and time,
- ignoring leap seconds.</p>
+ is as follows:</strong> If <span title="parse a local date and time
+ string">parsing a date and time</span> from <var
+ title="">input</var> results in an error, then return an error;
+ otherwise, return the number of milliseconds elapsed from midnight
+ on the morning of 1970-01-01 (the time represented by the value
+ "<code title="">1970-01-01T00:00:00.0</code>") to the parsed <span
+ title="concept-datetime-local">local date and time</span>, ignoring
+ leap seconds.</p>
<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 date and time</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 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>
<p>The following common <code>input</code> element content

0 comments on commit b40fe61

Please sign in to comment.
Something went wrong with that request. Please try again.