Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[] (0) WF2: Define weeks.
git-svn-id: http://svn.whatwg.org/webapps@2385 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 31, 2008
1 parent 8e5c255 commit 5990bbc
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 38 deletions.
59 changes: 38 additions & 21 deletions index
Expand Up @@ -16,7 +16,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 30 October 2008</h2>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 31 October 2008</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -3190,19 +3190,35 @@

</ol><h5 id=weeks><span class=secno>2.4.4.6 </span>Weeks</h5>

<p>A <dfn id=concept-week 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>The <dfn id=week-number>week number</dfn> of a day is ...</p>

<p class=XXX>The <dfn id=week-number-of-the-last-day>week number of the last day</dfn> of a year ...</p>

<p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a year
<var title="">year</var> and week <var title="">week</var> if it
consists of the following components in the given order:</p>
<p>A <dfn id=concept-week title=concept-week>week</dfn> consists of a week-year
number and a week number representing a seven day period. Each
week-year in this calendaring system has either 52 weeks or 53
weeks, as defined below. A week is a seven-day period. The week
starting on the Gregorian date Monday December 29th 1969
(1969-12-29) is defined as week number 1 in week-year
1970. Consecutive weeks are numbered sequentially. The week before
the number 1 week in a week-year is the last week in the previous
week-year, and vice versa. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>

<p>A week-year with a number <var title="">year</var> that
corresponds to a year <var title="">year</var> in the Gregorian
calendar that has a Thursday as its first day (January 1st), and a
week-year <var title="">year</var> where <var title="">year</var> is
a number divisible by 400, or a number divisible by 4 but not by
100, has 53 weeks. All other week-years have 52 weeks.</p>

<p>The <dfn id=week-number-of-the-last-day>week number of the last day</dfn> of a week-year with 53
weeks is 53; the week number of the last day of a week-year with 52
weeks is 52.</p>

<p class=note>The week-year number of a particular day can be
different than the number of the year that contains that day in the
Gregorian calendar. The first week in a week-year <var title="">year</var> is the week that contains the first Thursday of
the Gregorian year <var title="">year</var>.</p>

<p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a
week-year <var title="">year</var> and week <var title="">week</var>
if it consists of the following components in the given order:</p>

<ol><li>Four or more <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>, representing <var title="">year</var></li>

Expand All @@ -3213,12 +3229,12 @@
<li>Two <a href=#concept-datetime-digit title=concept-datetime-digit>digits</a>,
representing the week <var title="">week</var>, in the range
1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var title="">maxweek</var>, where <var title="">maxweek</var> is the
<a href=#week-number-of-the-last-day>week number of the last day</a> of year <var title="">year</var></li>
<a href=#week-number-of-the-last-day>week number of the last day</a> of week-year <var title="">year</var></li>

</ol><p>The rules to <dfn id=parse-a-week-string>parse a week string</dfn> are as follows. This
will either return a year and week, 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>
will either return a week-year number and week number, 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.</li>
Expand All @@ -3236,7 +3252,7 @@
then fail. Otherwise, move <var title="">position</var> forwards
one character.</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 0057 LATIN CAPITAL LETTER W
<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+0057 LATIN CAPITAL LETTER W
character, then fail. Otherwise, move <var title="">position</var>
forwards one character.</li>

Expand All @@ -3255,7 +3271,8 @@
<li><p>If <var title="">position</var> is <em>not</em> beyond the
end of <var title="">input</var>, then fail.</li>

<li><p>Return <var title="">year</var> and <var title="">week</var>.</li>
<li><p>Return the week-year number <var title="">year</var> and the
week number <var title="">week</var>.</li>

</ol><h5 id=vaguer-moments-in-time><span class=secno>2.4.4.7 </span>Vaguer moments in time</h5>

Expand Down Expand Up @@ -23356,7 +23373,7 @@ function AddCloud(data, x, y) { ... }</pre>
<td> A month control
<tr><td> <dfn id=attr-input-type-week-keyword title=attr-input-type-week-keyword><code>week</code></dfn>
<td> <a href=#week-state title=attr-input-type-week>Week</a>
<td> A date consisting of a year and a week number with no time zone
<td> A date consisting of a week-year number and a week number with no time zone
<td> A week control
<tr><td> <dfn id=attr-input-type-time-keyword title=attr-input-type-time-keyword><code>time</code></dfn>
<td> <a href=#time-state title=attr-input-type-time>Time</a>
Expand Down
51 changes: 34 additions & 17 deletions source
Expand Up @@ -2633,20 +2633,37 @@

<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
<p>A <dfn title="concept-week">week</dfn> consists of a week-year
number and a week number representing a seven day period. Each
week-year in this calendaring system has either 52 weeks or 53
weeks, as defined below. A week is a seven-day period. The week
starting on the Gregorian date Monday December 29th 1969
(1969-12-29) is defined as week number 1 in week-year
1970. Consecutive weeks are numbered sequentially. The week before
the number 1 week in a week-year is the last week in the previous
week-year, and vice versa. <a
href="#refsGREGORIAN">[GREGORIAN]</a></p>

<!-- XXX ISO week information -->
<p>A week-year with a number <var title="">year</var> that
corresponds to a year <var title="">year</var> in the Gregorian
calendar that has a Thursday as its first day (January 1st), and a
week-year <var title="">year</var> where <var title="">year</var> is
a number divisible by 400, or a number divisible by 4 but not by
100, has 53 weeks. All other week-years have 52 weeks.</p>

<p class="XXX">The <dfn>week number</dfn> of a day is ...</p>
<p>The <dfn>week number of the last day</dfn> of a week-year with 53
weeks is 53; the week number of the last day of a week-year with 52
weeks is 52.</p>

<p class="XXX">The <dfn>week number of the last day</dfn> of a year ...</p>
<p class="note">The week-year number of a particular day can be
different than the number of the year that contains that day in the
Gregorian calendar. The first week in a week-year <var
title="">year</var> is the week that contains the first Thursday of
the Gregorian year <var title="">year</var>.</p>

<p>A string is a <dfn>valid week string</dfn> representing a year
<var title="">year</var> and week <var title="">week</var> if it
consists of the following components in the given order:</p>
<p>A string is a <dfn>valid week string</dfn> representing a
week-year <var title="">year</var> and week <var title="">week</var>
if it consists of the following components in the given order:</p>

<ol>

Expand All @@ -2662,15 +2679,15 @@
representing the week <var title="">week</var>, in the range
1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var
title="">maxweek</var>, where <var title="">maxweek</var> is the
<span>week number of the last day</span> of year <var
<span>week number of the last day</span> of week-year <var
title="">year</var></li>

</ol>

<p>The rules to <dfn>parse a week string</dfn> are as follows. This
will either return a year and week, 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>
will either return a week-year number and week number, 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>

Expand All @@ -2695,7 +2712,7 @@

<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 0057 LATIN CAPITAL LETTER W
title="">position</var> is not a U+0057 LATIN CAPITAL LETTER W
character, then fail. Otherwise, move <var title="">position</var>
forwards one character.</p></li>

Expand All @@ -2715,8 +2732,8 @@
<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="">week</var>.</p></li>
<li><p>Return the week-year number <var title="">year</var> and the
week number <var title="">week</var>.</p></li>

</ol>

Expand Down Expand Up @@ -26061,7 +26078,7 @@ function AddCloud(data, x, y) { ... }</pre>
<tr>
<td> <dfn title="attr-input-type-week-keyword"><code>week</code></dfn>
<td> <span title="attr-input-type-week">Week</span>
<td> A date consisting of a year and a week number with no time zone
<td> A date consisting of a week-year number and a week number with no time zone
<td> A week control
<tr>
<td> <dfn title="attr-input-type-time-keyword"><code>time</code></dfn>
Expand Down

0 comments on commit 5990bbc

Please sign in to comment.