Skip to content

Commit

Permalink
Revert inadvertent normative change
Browse files Browse the repository at this point in the history
05f7a11 (part of #2670)
inadvertently made an observable change. This restores the previous
observable semantics.

Thanks to Anba for spotting this.

Closes: #2721
  • Loading branch information
ptomato authored and Ms2ger committed Jan 8, 2024
1 parent 9372524 commit 0cd94eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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), [
Expand Down Expand Up @@ -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, []);
Expand Down
2 changes: 1 addition & 1 deletion spec/plainyearmonth.html
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ <h1>
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"* »).
Expand All @@ -694,7 +695,6 @@ <h1>
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_, «»).
Expand Down

0 comments on commit 0cd94eb

Please sign in to comment.