From 18d035f03a756c95a5b92907183bb3ad95dc0a4e Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 20 Nov 2023 12:23:55 -0800 Subject: [PATCH] Revert inadvertent normative change 05f7a113 (part of https://github.com/tc39/proposal-temporal/pull/2670) inadvertently made an observable change. This restores the previous observable semantics. Thanks to Anba for spotting this. Closes: #2721 --- polyfill/lib/ecmascript.mjs | 2 +- spec/plainyearmonth.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 9e08ad6cbf..e36bfa7da0 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -5201,6 +5201,7 @@ export function AddDurationToOrSubtractDurationFromPlainYearMonth(operation, yea } let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration; ({ days } = BalanceTimeDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'day')); + options = GetOptionsObject(options); const sign = DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); const calendarRec = new CalendarMethodRecord(GetSlot(yearMonth, CALENDAR), [ @@ -5240,7 +5241,6 @@ export function AddDurationToOrSubtractDurationFromPlainYearMonth(operation, yea startDate = CalendarDateFromFields(calendarRec, fieldsCopy); } const durationToAdd = new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0); - options = GetOptionsObject(options); const optionsCopy = SnapshotOwnProperties(options, null); const addedDate = AddDate(calendarRec, startDate, durationToAdd, options); const addedDateFields = PrepareTemporalFields(addedDate, fieldNames, []); diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html index 0fe491e23d..df62cb4bb5 100644 --- a/spec/plainyearmonth.html +++ b/spec/plainyearmonth.html @@ -676,6 +676,7 @@

1. If _operation_ is ~subtract~, then 1. Set _duration_ to ! CreateNegatedTemporalDuration(_duration_). 1. Let _balanceResult_ be ? BalanceTimeDuration(_duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], *"day"*). + 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0). 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_yearMonth_.[[Calendar]], « ~dateAdd~, ~dateFromFields~, ~day~, ~fields~, ~yearMonthFromFields~ »). 1. Let _fieldNames_ be ? CalendarFields(_calendarRec_, « *"monthCode"*, *"year"* »). @@ -694,7 +695,6 @@

1. Else, 1. Let _date_ be _intermediateDate_. 1. Let _durationToAdd_ be ! CreateTemporalDuration(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0). - 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _optionsCopy_ be ? SnapshotOwnProperties(_options_, *null*). 1. Let _addedDate_ be ? AddDate(_calendarRec_, _date_, _durationToAdd_, _options_). 1. Let _addedDateFields_ be ? PrepareTemporalFields(_addedDate_, _fieldNames_, «»).