diff --git a/spec/calendar.html b/spec/calendar.html
index c6d4daedd..d2fff2241 100644
--- a/spec/calendar.html
+++ b/spec/calendar.html
@@ -135,7 +135,7 @@
Calendar Date Records
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]].
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.
- See also ToISOWeekOfYear.
+ See also ISOWeekOfYear.
The Year-Week Record contains *undefined* in [[Week]] and [[Year]] field for calendars that do not have a well-defined week calendar system.
@@ -667,12 +667,10 @@
-
+
- ToISOWeekOfYear (
- _year_: an integer,
- _month_: an integer,
- _day_: an integer,
+ ISOWeekOfYear (
+ _isoDate_: an ISO Date Record,
): a Year-Week Record
- 1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
+ 1. Let _year_ be _isoDate_.[[Year]].
1. Let _wednesday_ be 3.
1. Let _thursday_ be 4.
1. Let _friday_ be 5.
1. Let _saturday_ be 6.
1. Let _daysInWeek_ be 7.
1. Let _maxWeekNumber_ be 53.
- 1. Let _dayOfYear_ be ToISODayOfYear(_year_, _month_, _day_).
- 1. Let _dayOfWeek_ be ToISODayOfWeek(_year_, _month_, _day_).
- 1. Let _week_ be floor((_dayOfYear_ + _daysInWeek_ - _dayOfWeek_ + _wednesday_ ) / _daysInWeek_).
+ 1. Let _dayOfYear_ be ISODayOfYear(_isoDate_).
+ 1. Let _dayOfWeek_ be ISODayOfWeek(_isoDate_).
+ 1. Let _week_ be floor((_dayOfYear_ + _daysInWeek_ - _dayOfWeek_ + _wednesday_) / _daysInWeek_).
1. If _week_ < 1, then
1. NOTE: This is the last week of the previous year.
- 1. Let _dayOfJan1st_ be ToISODayOfWeek(_year_, 1, 1).
+ 1. Let _jan1st_ be CreateISODateRecord(_year_, 1, 1).
+ 1. Let _dayOfJan1st_ be ISODayOfWeek(_jan1st_).
1. If _dayOfJan1st_ = _friday_, then
1. Return Year-Week Record { [[Week]]: _maxWeekNumber_, [[Year]]: _year_ - 1 }.
1. If _dayOfJan1st_ = _saturday_, and MathematicalInLeapYear(EpochTimeForYear(_year_ - 1)) = 1, then
@@ -710,12 +709,10 @@
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).
-
+
- ToISODayOfYear (
- _year_: an integer,
- _month_: an integer,
- _day_: an integer,
+ ISODayOfYear (
+ _isoDate_: an ISO Date Record,
): an integer
- 1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
- 1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_).
+ 1. Let _epochDays_ be ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]]).
1. Return EpochTimeToDayInYear(EpochDaysToEpochMs(_epochDays_, 0)) + 1.
-
+
- ToISODayOfWeek (
- _year_: an integer,
- _month_: an integer,
- _day_: an integer,
+ ISODayOfWeek (
+ _isoDate_: an ISO Date Record,
): an integer
- 1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*.
- 1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_).
+ 1. Let _epochDays_ be ISODateToEpochDays(_isoDate_.[[Year]], _isoDate_.[[Month]] - 1, _isoDate_.[[Day]]).
1. Let _dayOfWeek_ be EpochTimeToWeekDay(EpochDaysToEpochMs(_epochDays_, 0)).
1. If _dayOfWeek_ = 0, return 7.
1. Return _dayOfWeek_.
@@ -847,9 +840,9 @@