diff --git a/spec.emu b/spec.emu index 6cd16c6..a346a98 100644 --- a/spec.emu +++ b/spec.emu @@ -662,6 +662,26 @@ contributors: Google, Ecma International + +

+ CalendarDaysInMonth ( + _calendar_: a calendar type that is not *"iso8601"*, + _arithmeticYear_: an integer, + _ordinalMonth_: a positive integer, + ): an integer +

+
+
description
+
+ It returns the number of days in the _calendar_-specific _arithmeticYear_ and _ordinalMonth_. +
+
+

It performs the following steps when called:

+ + 1. Return the number of days in the month of _calendar_ corresponding to _arithmeticYear_ and _ordinalMonth_. + +
+

IsValidEraYearForCalendar ( @@ -844,6 +864,29 @@ contributors: Google, Ecma International + +

+ CalendarIntegersToISO ( + _calendar_: a calendar type that is not *"iso8601"*, + _arithmeticYear_: an integer, + _ordinalMonth_: a positive integer, + _day_: a positive integer, + ): either a normal completion containing an ISO Date Record or a throw completion +

+
+
description
+
+ It returns an ISO Date Record that corresponds with the given _calendar_-specific _arithmeticYear_, _ordinalMonth_, and _day_. +
+
+

It performs the following steps when called:

+ + 1. If _arithmeticYear_, _ordinalMonth_, and _day_ do not form a valid date in _calendar_, throw a RangeError exception. + 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_. + 1. Return _isoDate_. + +
+

Calendar Date Records

@@ -1087,8 +1130,14 @@ contributors: Google, Ecma International 1. Let _ordinalMonth_ be _fields_.[[Month]]. 1. Let _day_ be _fields_.[[Day]]. 1. Assert: _day_ is not ~unset~. - 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. - 1. Return an implementation-defined ISO Date Record that corresponds to the date described by _calendar_, _arithmeticYear_, _ordinalMonth_, and _day_. + 1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _arithmeticYear_, _ordinalMonth_). + 1. If _daysInMonth_ < _day_, then + 1. If _overflow_ is ~reject~, throw a *RangeError* exception. + 1. Let _regulatedDay_ be _daysInMonth_. + 1. Else, + 1. Assert: _day_ ≥ 1. + 1. Let _regulatedDay_ be _day_. + 1. Return ? CalendarIntegersToISO(_calendar_, _arithmeticYear_, _ordinalMonth_, _regulatedDay_).