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
_calendar_: a calendar type that is not *"iso8601"*,
889
-
_isoDate_: an ISO Date Record,
890
-
_duration_: a Date Duration Record,
891
-
_overflow_: ~constrain~ or ~reject~,
892
-
): either a normal completion containing an ISO Date Record or a throw completion
893
-
</h1>
894
-
<dl class="header">
895
-
<dt>description</dt>
896
-
<dd>
897
-
The operation performs implementation-defined processing to add _duration_ to _date_ in the context of the calendar represented by _calendar_ and returns the corresponding day, month and year of the result in the ISO 8601 calendar values as an ISO Date Record.
898
-
It may throw a *RangeError* exception if _overflow_ is ~reject~ and the resulting month or day would need to be clamped in order to form a valid date in _calendar_.
899
-
</dd>
900
-
</dl>
901
-
<p>The behaviour is implementation-defined, but all calendars follow the general steps given here, which is a generalization of the precise algorithm specified in CalendarDateAdd for *"iso8601"*.</p>
902
-
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal-nonisodateadd"></emu-xref>.</p>
903
-
<p>It performs the following steps when called:</p>
904
-
<emu-alg>
905
-
1. Let _parts_ be CalendarISOToDate(_calendar_, _isoDate_).
906
-
1. Let _yearMonth_ be RegulateNonISOYearMonth(_calendar_, _parts_.[[Year]], _parts_.[[MonthCode]], _duration_.[[Years]]).
907
-
1. Let _endOfMonth_ be BalanceNonISODate(_calendar_, _yearMonth_.[[Year]], _yearMonth_.[[Month]] + _duration_.[[Months]] + 1, 0).
908
-
1. Let _baseDay_ be _parts_.[[Day]].
909
-
1. If _endOfMonth_.[[Day]] < _baseDay_, then
910
-
1. If _overflow_ is ~reject~, throw a *RangeError* exception.
911
-
1. Let _regulatedDay_ be _endOfMonth_.[[Day]].
912
-
1. Else,
913
-
1. Let _regulatedDay_ be _baseDay_.
914
-
1. Let _balancedDate_ be BalanceNonISODate(_calendar_, _endOfMonth_.[[Year]], _endOfMonth_.[[Month]], _regulatedDay_ + 7 * _duration_.[[Weeks]] + _duration_.[[Days]]).
915
-
1. Let _result_ be ? CalendarDateArithmeticalToISO(_calendar_, _balancedDate_.[[Year]], _balancedDate_.[[Month]], _balancedDate_.[[Day]]).
916
-
1. If ISODateWithinLimits(_result_) is *false*, throw a *RangeError* exception.
_calendar_: a calendar type that is not *"iso8601"*,
1180
+
_isoDate_: an ISO Date Record,
1181
+
_duration_: a Date Duration Record,
1182
+
_overflow_: ~constrain~ or ~reject~,
1183
+
): either a normal completion containing an ISO Date Record or a throw completion
1184
+
</h1>
1185
+
<dl class="header">
1186
+
<dt>description</dt>
1187
+
<dd>
1188
+
The operation performs implementation-defined processing to add _duration_ to _date_ in the context of the calendar represented by _calendar_ and returns the corresponding day, month and year of the result in the ISO 8601 calendar values as an ISO Date Record.
1189
+
It may throw a *RangeError* exception if _overflow_ is ~reject~ and the resulting month or day would need to be clamped in order to form a valid date in _calendar_.
1190
+
</dd>
1191
+
</dl>
1192
+
<p>The behaviour is implementation-defined, but all calendars follow the general steps given here, which is a generalization of the precise algorithm specified in CalendarDateAdd for *"iso8601"*.</p>
1193
+
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal-nonisodateadd"></emu-xref>.</p>
1194
+
<p>It performs the following steps when called:</p>
1195
+
<emu-alg>
1196
+
1. Let _parts_ be CalendarISOToDate(_calendar_, _isoDate_).
1197
+
1. Let _yearMonth_ be RegulateNonISOYearMonth(_calendar_, _parts_.[[Year]], _parts_.[[MonthCode]], _duration_.[[Years]]).
1198
+
1. Let _endOfMonth_ be BalanceNonISODate(_calendar_, _yearMonth_.[[Year]], _yearMonth_.[[Month]] + _duration_.[[Months]] + 1, 0).
1199
+
1. Let _baseDay_ be _parts_.[[Day]].
1200
+
1. If _endOfMonth_.[[Day]] < _baseDay_, then
1201
+
1. If _overflow_ is ~reject~, throw a *RangeError* exception.
1202
+
1. Let _regulatedDay_ be _endOfMonth_.[[Day]].
1203
+
1. Else,
1204
+
1. Let _regulatedDay_ be _baseDay_.
1205
+
1. Let _balancedDate_ be BalanceNonISODate(_calendar_, _endOfMonth_.[[Year]], _endOfMonth_.[[Month]], _regulatedDay_ + 7 * _duration_.[[Weeks]] + _duration_.[[Days]]).
1206
+
1. Let _result_ be ? CalendarDateArithmeticalToISO(_calendar_, _balancedDate_.[[Year]], _balancedDate_.[[Month]], _balancedDate_.[[Day]]).
1207
+
1. If ISODateWithinLimits(_result_) is *false*, throw a *RangeError* exception.
0 commit comments