Skip to content

Commit b772f6f

Browse files
authored
Editorial: Refactor the last bit of prose in NonISOCalendarDateToISO to AOs (#74)
1 parent fe3dac5 commit b772f6f

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

spec.emu

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,26 @@ contributors: Google, Ecma International
678678
</emu-alg>
679679
</emu-clause>
680680

681+
<emu-clause id="sec-temporal-calendardaysinmonth" type="implementation-defined abstract operation">
682+
<h1>
683+
CalendarDaysInMonth (
684+
_calendar_: a calendar type that is not *"iso8601"*,
685+
_arithmeticYear_: an integer,
686+
_ordinalMonth_: a positive integer,
687+
): an integer
688+
</h1>
689+
<dl class="header">
690+
<dt>description</dt>
691+
<dd>
692+
It returns the number of days in the _calendar_-specific _arithmeticYear_ and _ordinalMonth_.
693+
</dd>
694+
</dl>
695+
<p>It performs the following steps when called:</p>
696+
<emu-alg>
697+
1. Return the number of days in the month of _calendar_ corresponding to _arithmeticYear_ and _ordinalMonth_.
698+
</emu-alg>
699+
</emu-clause>
700+
681701
<emu-clause id="sec-temporal-isvaliderayearforcalendar" type="abstract operation">
682702
<h1>
683703
IsValidEraYearForCalendar (
@@ -860,6 +880,29 @@ contributors: Google, Ecma International
860880
</emu-alg>
861881
</emu-clause>
862882

883+
<emu-clause id="sec-temporal-calendarintegerstoiso" type="implementation-defined abstract operation">
884+
<h1>
885+
CalendarIntegersToISO (
886+
_calendar_: a calendar type that is not *"iso8601"*,
887+
_arithmeticYear_: an integer,
888+
_ordinalMonth_: a positive integer,
889+
_day_: a positive integer,
890+
): either a normal completion containing an ISO Date Record or a throw completion
891+
</h1>
892+
<dl class="header">
893+
<dt>description</dt>
894+
<dd>
895+
It returns an ISO Date Record that corresponds with the given _calendar_-specific _arithmeticYear_, _ordinalMonth_, and _day_.
896+
</dd>
897+
</dl>
898+
<p>It performs the following steps when called:</p>
899+
<emu-alg>
900+
1. If _arithmeticYear_, _ordinalMonth_, and _day_ do not form a valid date in _calendar_, throw a RangeError exception.
901+
1. Let _isoDate_ be an ISO Date Record such that CalendarISOToDate(_calendar_, _isoDate_) returns a Calendar Date Record whose [[Year]], [[Month]], and [[Day]] field values respectively equal _arithmeticYear_, _ordinalMonth_, and _day_.
902+
1. Return _isoDate_.
903+
</emu-alg>
904+
</emu-clause>
905+
863906
<emu-clause id="sup-temporal-calendar-date-records">
864907
<h1>Calendar Date Records</h1>
865908
<p>
@@ -1103,8 +1146,14 @@ contributors: Google, Ecma International
11031146
1. Let _ordinalMonth_ be _fields_.[[Month]].
11041147
1. Let _day_ be _fields_.[[Day]].
11051148
1. Assert: _day_ is not ~unset~.
1106-
1. If the date described by _calendar_, _arithmeticYear_, _ordinalMonth_, and _day_ does not exist, set _day_ to the closest day in the same month. If there are two equally-close dates in the same month, pick the later one.
1107-
1. Return an implementation-defined ISO Date Record that corresponds to the date described by _calendar_, _arithmeticYear_, _ordinalMonth_, and _day_.
1149+
1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _arithmeticYear_, _ordinalMonth_).
1150+
1. If _daysInMonth_ &lt; _day_, then
1151+
1. If _overflow_ is ~reject~, throw a *RangeError* exception.
1152+
1. Let _regulatedDay_ be _daysInMonth_.
1153+
1. Else,
1154+
1. Assert: _day_ ≥ 1.
1155+
1. Let _regulatedDay_ be _day_.
1156+
1. Return ? CalendarIntegersToISO(_calendar_, _arithmeticYear_, _ordinalMonth_, _regulatedDay_).
11081157
</emu-alg>
11091158
</emu-clause>
11101159

0 commit comments

Comments
 (0)