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.emu
+30-13Lines changed: 30 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -902,20 +902,16 @@ contributors: Google, Ecma International
902
902
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal-nonisodateadd"></emu-xref>.</p>
903
903
<p>It performs the following steps when called:</p>
904
904
<emu-alg>
905
-
1. Let _calendarDate_ be CalendarISOToDate(_calendar_, _isoDate_).
906
-
1. Add _duration_.[[Years]] to _calendarDate_.
907
-
1. (This step only matters for lunisolar calendars.) If _calendarDate_.[[MonthCode]] is a leap month that doesn't exist in the year, then:
908
-
1. Set _calendarDate_ to another date according to the cultural conventions of that calendar's users. Of the currently supported calendars: if _calendar_ is *"chinese"* or *"dangi"*, change _calendarDate_.[[MonthCode]] to the same month code but without the *"L"*. If _calendar_ is *"hebrew"*, change _calendarDate_.[[MonthCode]] from *"M05L"* to *"M06"*.
909
-
1. Update _calendarDate_.[[Month]] accordingly.
910
-
1. Add _duration_.[[Months]] to _calendarDate_, balancing _calendarDate_ if it goes over a year boundary.
911
-
1. If the date described by _calendarDate_ does not exist, then
905
+
1. Let _yearMonth_ be RegulateNonISOYearMonth(_calendar_, _isoDate_, _years_).
906
+
1. Let _endOfMonth_ be BalanceNonISODate(_calendar_, _yearMonth_.[[Year]], _yearMonth_.[[Month]] + _months_ + 1, 0).
907
+
1. Let _baseDay_ be CalendarISOToDate(_calendar_, _isoDate_).[[Day]].
908
+
1. If _endOfMonth_.[[Day]] < _baseDay_, then
912
909
1. If _overflow_ is ~reject~, throw a *RangeError* exception.
913
-
1. If _calendarDate_.[[MonthCode]] is a valid month code for _calendarDate_.[[Year]], but the date described by _calendarDate_ does not exist, set _calendarDate_.[[Day]] to the closest day in the same month. If there are two equally-close dates in the same month, pick the later one.
914
-
1. (This step does not apply to any currently supported calendars.) If the date described by _calendarDate_ still does not exist, set _calendarDate_ to the closest date in the same year. If there are two equally-close dates in that year, pick the later one.
915
-
1. Add _duration_.[[Weeks]] and _duration_.[[Days]] to _calendarDate_, balancing _calendarDate_ if it goes over a month or year boundary.
916
-
1. Let _result_ be ? CalendarDateToISO(_calendar_, _calendarDate_, _overflow_).
917
-
1. If ISODateWithinLimits(_result_) is *false*, throw a *RangeError* exception.
918
-
1. Return _result_.
910
+
1. Let _regulatedDay_ be _endOfMonth_.[[Day]].
911
+
1. Else,
912
+
1. Let _regulatedDay_ be _baseDay_.
913
+
1. Let _balancedDate_ be BalanceNonISODate(_calendar_, _endOfMonth_.[[Year]], _endOfMonth_.[[Month]], _regulatedDay_ + 7 * _duration_.[[Weeks]] + _duration_.[[Days]]).
_calendar_: a calendar type that is not *"iso8601"*,
1017
+
_year_: an integer,
1018
+
_month_: an integer,
1019
+
_day_: an integer,
1020
+
): either a normal completion containing an ISO Date Record or a throw completion
1021
+
</h1>
1022
+
<dl class="header">
1023
+
<dt>description</dt>
1024
+
<dd>
1025
+
It returns an ISO Date Record that, when converted to a Calendar Date Record with _calendar_ (for example, with CalendarISOToDate), contains the given _year_, _month_, and _day_ values in its [[Year]], [[Month]], and [[Day]] fields. If this is not possible, a RangeError is thrown.
1026
+
</dd>
1027
+
</dl>
1028
+
<p>It performs the following steps when called:</p>
1029
+
<emu-alg>
1030
+
Returns a calendar-dependent completion as described above.
0 commit comments