You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/calendar.html
+21-28Lines changed: 21 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -135,7 +135,7 @@ <h1>Calendar Date Records</h1>
135
135
<p>The Year-Week Record's [[Year]] field is relative to the first day of a calendar-specific "epoch year", as in the Calendar Date Record's [[Year]] field, not relative to an era as in [[EraYear]].</p>
136
136
<p>
137
137
Usually the Year-Week Record's [[Year]] field will contain the same value as the Calendar Date Record's [[Year]] field, but may contain the previous or next year if the week number in the Year-Week Record's [[Week]] field overlaps two different years.
138
-
See also ToISOWeekOfYear.
138
+
See also ISOWeekOfYear.
139
139
</p>
140
140
<p>The Year-Week Record contains *undefined* in [[Week]] and [[Year]] field for calendars that do not have a well-defined week calendar system.</p>
<dd>It determines where a calendar day falls in the ISO 8601 week calendar and calculates its <em>calendar week of year</em>, which is the 1-based ordinal number of its calendar week within the corresponding <em>week calendar year</em> (which may differ from _year_ by up to 1 in either direction).</dd>
681
679
</dl>
682
680
<emu-alg>
683
-
1.Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
681
+
1.Let _year_ be _isoDate_.[[Year]].
684
682
1. Let _wednesday_ be 3.
685
683
1. Let _thursday_ be 4.
686
684
1. Let _friday_ be 5.
687
685
1. Let _saturday_ be 6.
688
686
1. Let _daysInWeek_ be 7.
689
687
1. Let _maxWeekNumber_ be 53.
690
-
1. Let _dayOfYear_ be ToISODayOfYear(_year_, _month_, _day_).
691
-
1. Let _dayOfWeek_ be ToISODayOfWeek(_year_, _month_, _day_).
692
-
1. Let _week_ be floor((_dayOfYear_ + _daysInWeek_ - _dayOfWeek_ + _wednesday_) / _daysInWeek_).
688
+
1. Let _dayOfYear_ be ISODayOfYear(_isoDate_).
689
+
1. Let _dayOfWeek_ be ISODayOfWeek(_isoDate_).
690
+
1. Let _week_ be floor((_dayOfYear_ + _daysInWeek_ - _dayOfWeek_ + _wednesday_) / _daysInWeek_).
693
691
1. If _week_< 1, then
694
692
1. NOTE: This is the last week of the previous year.
695
-
1. Let _dayOfJan1st_ be ToISODayOfWeek(_year_, 1, 1).
693
+
1. Let _jan1st_ be CreateISODateRecord(_year_, 1, 1).
1. If _dayOfJan1st_ = _saturday_, and MathematicalInLeapYear(EpochTimeForYear(_year_ - 1)) = 1, then
@@ -710,40 +709,34 @@ <h1>
710
709
<emu-note>For example, week calendar year 2020 includes both 31 December 2019 (a Tuesday belonging to its calendar week 1) and 1 January 2021 (a Friday belonging to its calendar week 53).</emu-note>
<dd>It returns the ISO 8601 <em>calendar day of year</em> of a calendar day, which is its 1-based ordinal number within its ISO 8601 calendar year.</dd>
724
721
</dl>
725
722
<emu-alg>
726
-
1.Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
727
-
1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_).
723
+
1. Let _epochDays_ be ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]]).
<dd>It returns the ISO 8601 <em>calendar day of week</em> of a calendar day, which is its 1-based ordinal position within the sequence of week calendar days that starts with Monday at 1 and ends with Sunday at 7.</dd>
743
737
</dl>
744
738
<emu-alg>
745
-
1.Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
746
-
1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_).
739
+
1. Let _epochDays_ be ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]]).
747
740
1. Let _dayOfWeek_ be EpochTimeToWeekDay(EpochDaysToEpochMs(_epochDays_, 0)).
The <dfnvariants="Year-Week Records">Year-Week Record</dfn> specification type is returned by the week number calculation in ToISOWeekOfYear, and the corresponding calculations for other calendars if applicable.
36
+
The <dfnvariants="Year-Week Records">Year-Week Record</dfn> specification type is returned by the week number calculation in ISOWeekOfYear, and the corresponding calculations for other calendars if applicable.
37
37
It comprises a <em>calendar week of year</em> with the corresponding <em>week calendar year</em>.
38
38
</p>
39
39
<p>Year-Week Records have the fields listed in table <emu-xrefhref="#table-year-week-record"></emu-xref>.</p>
0 commit comments