diff --git a/polyfill/lib/duration.mjs b/polyfill/lib/duration.mjs
index a98e37fbfc..0aff79bc5b 100644
--- a/polyfill/lib/duration.mjs
+++ b/polyfill/lib/duration.mjs
@@ -329,35 +329,7 @@ export class Duration {
let calendarRec;
if (zonedRelativeTo || plainRelativeTo) {
const calendar = GetSlot(zonedRelativeTo ?? plainRelativeTo, CALENDAR);
- calendarRec = new CalendarMethodRecord(calendar);
- if (
- years !== 0 ||
- months !== 0 ||
- weeks !== 0 ||
- largestUnit === 'year' ||
- largestUnit === 'month' ||
- largestUnit === 'week' ||
- smallestUnit === 'year' ||
- smallestUnit === 'month' ||
- smallestUnit === 'week'
- ) {
- calendarRec.lookup('dateAdd');
- }
- if (
- largestUnit === 'year' ||
- (largestUnit === 'month' && years !== 0) ||
- smallestUnit === 'year' ||
- // Edge condition in AdjustRoundedDurationDays:
- (zonedRelativeTo &&
- !roundingGranularityIsNoop &&
- smallestUnit !== 'year' &&
- smallestUnit !== 'month' &&
- smallestUnit !== 'week' &&
- smallestUnit !== 'day' &&
- (largestUnit === 'year' || largestUnit === 'month' || largestUnit === 'week'))
- ) {
- calendarRec.lookup('dateUntil');
- }
+ calendarRec = new CalendarMethodRecord(calendar, ['dateAdd', 'dateUntil']);
}
({ years, months, weeks, days } = ES.UnbalanceDateDurationRelative(
@@ -500,13 +472,7 @@ export class Duration {
calendar = GetSlot(plainRelativeTo, CALENDAR);
}
if (calendar) {
- calendarRec = new CalendarMethodRecord(calendar);
- if (years !== 0 || months !== 0 || weeks !== 0 || unit === 'year' || unit === 'month' || unit === 'week') {
- calendarRec.lookup('dateAdd');
- }
- if (unit === 'year' || (unit === 'month' && years !== 0)) {
- calendarRec.lookup('dateUntil');
- }
+ calendarRec = new CalendarMethodRecord(calendar, ['dateAdd', 'dateUntil']);
}
// Convert larger units down to days
@@ -724,8 +690,7 @@ export class Duration {
let calendarRec;
if (zonedRelativeTo || plainRelativeTo) {
- calendarRec = new CalendarMethodRecord(GetSlot(zonedRelativeTo ?? plainRelativeTo, CALENDAR));
- if (calendarUnitsPresent) calendarRec.lookup('dateAdd');
+ calendarRec = new CalendarMethodRecord(GetSlot(zonedRelativeTo ?? plainRelativeTo, CALENDAR), ['dateAdd']);
}
if (zonedRelativeTo && (calendarUnitsPresent || d1 != 0 || d2 !== 0)) {
diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs
index 7fff13efdf..03d17bf457 100644
--- a/polyfill/lib/ecmascript.mjs
+++ b/polyfill/lib/ecmascript.mjs
@@ -4302,18 +4302,7 @@ export function DifferenceTemporalPlainDate(operation, plainDate, other, options
return new Duration();
}
- const calendarRec = new CalendarMethodRecord(calendar);
- if (settings.smallestUnit === 'year' || settings.smallestUnit === 'month' || settings.smallestUnit === 'week') {
- calendarRec.lookup('dateAdd');
- }
- if (
- settings.largestUnit === 'year' ||
- settings.largestUnit === 'month' ||
- settings.largestUnit === 'week' ||
- settings.smallestUnit === 'year'
- ) {
- calendarRec.lookup('dateUntil');
- }
+ const calendarRec = new CalendarMethodRecord(calendar, ['dateAdd', 'dateUntil']);
resolvedOptions.largestUnit = settings.largestUnit;
const untilResult = DifferenceDate(calendarRec, plainDate, other, resolvedOptions);
@@ -4372,17 +4361,7 @@ export function DifferenceTemporalPlainDateTime(operation, plainDateTime, other,
return new Duration();
}
- const calendarRec = new CalendarMethodRecord(calendar);
- if (settings.smallestUnit === 'year' || settings.smallestUnit === 'month' || settings.smallestUnit === 'week') {
- calendarRec.lookup('dateAdd');
- }
- if (
- (!datePartsIdentical &&
- (settings.largestUnit === 'year' || settings.largestUnit === 'month' || settings.largestUnit === 'week')) ||
- settings.smallestUnit === 'year'
- ) {
- calendarRec.lookup('dateUntil');
- }
+ const calendarRec = new CalendarMethodRecord(calendar, ['dateAdd', 'dateUntil']);
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } =
DifferenceISODateTime(
@@ -4537,13 +4516,7 @@ export function DifferenceTemporalPlainYearMonth(operation, yearMonth, other, op
return new Duration();
}
- const calendarRec = new CalendarMethodRecord(calendar);
- if (settings.smallestUnit !== 'month' || settings.roundingIncrement !== 1) {
- calendarRec.lookup('dateAdd');
- }
- calendarRec.lookup('dateFromFields');
- calendarRec.lookup('dateUntil');
- calendarRec.lookup('fields');
+ const calendarRec = new CalendarMethodRecord(calendar, ['dateAdd', 'dateFromFields', 'dateUntil', 'fields']);
const fieldNames = CalendarFields(calendarRec, ['monthCode', 'year']);
const thisFields = PrepareTemporalFields(yearMonth, fieldNames, []);
@@ -4721,7 +4694,7 @@ export function AddISODate(year, month, day, years, months, weeks, days, overflo
}
export function AddDate(calendarRec, plainDate, duration, options = undefined) {
- // dateAdd must be looked up if years, months, weeks != 0
+ // dateAdd must be looked up
const years = GetSlot(duration, YEARS);
const months = GetSlot(duration, MONTHS);
const weeks = GetSlot(duration, WEEKS);
@@ -5130,31 +5103,10 @@ export function AddDurationToOrSubtractDurationFromDuration(operation, duration,
let calendarRec;
if (plainRelativeTo || zonedRelativeTo) {
- calendarRec = new CalendarMethodRecord(GetSlot(zonedRelativeTo ?? plainRelativeTo, CALENDAR));
- if (
- GetSlot(duration, YEARS) !== 0 ||
- GetSlot(duration, MONTHS) !== 0 ||
- GetSlot(duration, WEEKS) !== 0 ||
- years !== 0 ||
- months !== 0 ||
- weeks !== 0
- ) {
- calendarRec.lookup('dateAdd');
- if (
- years !== 0 ||
- months !== 0 ||
- weeks !== 0 ||
- days !== 0 ||
- hours !== 0 ||
- minutes !== 0 ||
- seconds !== 0 ||
- milliseconds !== 0 ||
- microseconds !== 0 ||
- nanoseconds !== 0
- ) {
- calendarRec.lookup('dateUntil');
- }
- }
+ calendarRec = new CalendarMethodRecord(GetSlot(zonedRelativeTo ?? plainRelativeTo, CALENDAR), [
+ 'dateAdd',
+ 'dateUntil'
+ ]);
}
({ years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = AddDuration(
@@ -5214,10 +5166,7 @@ export function AddDurationToOrSubtractDurationFromPlainDateTime(operation, date
ToTemporalDurationRecord(durationLike);
options = GetOptionsObject(options);
- const calendarRec = new CalendarMethodRecord(GetSlot(dateTime, CALENDAR));
- if (years !== 0 || months !== 0 || weeks !== 0) {
- calendarRec.lookup('dateAdd');
- }
+ const calendarRec = new CalendarMethodRecord(GetSlot(dateTime, CALENDAR), ['dateAdd']);
const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = AddDateTime(
GetSlot(dateTime, ISO_YEAR),
@@ -5306,14 +5255,14 @@ export function AddDurationToOrSubtractDurationFromPlainYearMonth(operation, yea
({ days } = BalanceTimeDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'day'));
const sign = DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0);
- const calendarRec = new CalendarMethodRecord(GetSlot(yearMonth, CALENDAR));
- if (sign < 0 || years !== 0 || months !== 0 || weeks !== 0) {
- calendarRec.lookup('dateAdd');
- }
- calendarRec.lookup('dateFromFields');
- if (sign < 0) calendarRec.lookup('day');
- calendarRec.lookup('fields');
- calendarRec.lookup('yearMonthFromFields');
+ const calendarRec = new CalendarMethodRecord(GetSlot(yearMonth, CALENDAR), [
+ 'dateAdd',
+ 'dateFromFields',
+ 'day',
+ 'fields',
+ 'yearMonthFromFields'
+ ]);
+
const fieldNames = CalendarFields(calendarRec, ['monthCode', 'year']);
const fields = PrepareTemporalFields(yearMonth, fieldNames, []);
const fieldsCopy = SnapshotOwnProperties(fields, null);
@@ -5360,10 +5309,7 @@ export function AddDurationToOrSubtractDurationFromZonedDateTime(operation, zone
'getOffsetNanosecondsFor',
'getPossibleInstantsFor'
]);
- const calendarRec = new CalendarMethodRecord(GetSlot(zonedDateTime, CALENDAR));
- if (years !== 0 || months !== 0 || weeks !== 0) {
- calendarRec.lookup('dateAdd');
- }
+ const calendarRec = new CalendarMethodRecord(GetSlot(zonedDateTime, CALENDAR), ['dateAdd']);
const epochNanoseconds = AddZonedDateTime(
GetSlot(zonedDateTime, INSTANT),
timeZoneRec,
diff --git a/polyfill/lib/plaindate.mjs b/polyfill/lib/plaindate.mjs
index 06d4b695a7..b74236ef1c 100644
--- a/polyfill/lib/plaindate.mjs
+++ b/polyfill/lib/plaindate.mjs
@@ -14,9 +14,6 @@ import {
ISO_NANOSECOND,
CALENDAR,
EPOCHNANOSECONDS,
- MONTHS,
- WEEKS,
- YEARS,
GetSlot
} from './slots.mjs';
@@ -122,11 +119,7 @@ export class PlainDate {
const duration = ES.ToTemporalDuration(temporalDurationLike);
options = ES.GetOptionsObject(options);
- const calendarRec = new CalendarMethodRecord(GetSlot(this, CALENDAR));
- if (GetSlot(duration, YEARS) !== 0 || GetSlot(duration, MONTHS) !== 0 || GetSlot(duration, WEEKS) !== 0) {
- calendarRec.lookup('dateAdd');
- }
-
+ const calendarRec = new CalendarMethodRecord(GetSlot(this, CALENDAR), ['dateAdd']);
return ES.AddDate(calendarRec, this, duration, options);
}
subtract(temporalDurationLike, options = undefined) {
@@ -135,11 +128,7 @@ export class PlainDate {
const duration = ES.CreateNegatedTemporalDuration(ES.ToTemporalDuration(temporalDurationLike));
options = ES.GetOptionsObject(options);
- const calendarRec = new CalendarMethodRecord(GetSlot(this, CALENDAR));
- if (GetSlot(duration, YEARS) !== 0 || GetSlot(duration, MONTHS) !== 0 || GetSlot(duration, WEEKS) !== 0) {
- calendarRec.lookup('dateAdd');
- }
-
+ const calendarRec = new CalendarMethodRecord(GetSlot(this, CALENDAR), ['dateAdd']);
return ES.AddDate(calendarRec, this, duration, options);
}
until(other, options = undefined) {
diff --git a/spec/duration.html b/spec/duration.html
index 11c33b1a4a..5202a6a19d 100644
--- a/spec/duration.html
+++ b/spec/duration.html
@@ -105,9 +105,7 @@
Temporal.Duration.compare ( _one_, _two_ [ , _options_ ] )
1. Let _calendarRec_ be *undefined*.
1. If _zonedRelativeTo_ is not *undefined* or _plainRelativeTo_ is not *undefined*, then
1. If _zonedRelativeTo_ is not *undefined*, let _calendar_ be _zonedRelativeTo_.[[Calendar]]; else let _calendar_ be _plainRelativeTo_.[[Calendar]].
- 1. Set _calendarRec_ to ! CreateCalendarMethodsRecord(_calendar_, « »).
- 1. If _calendarUnitsPresent_ is *true*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
+ 1. Set _calendarRec_ to ? CreateCalendarMethodsRecord(_calendar_, « ~dateAdd~ »).
1. If _zonedRelativeTo_ is not *undefined*, and either _calendarUnitsPresent_ is *true*, or _one_.[[Days]] ≠ 0, or _two_.[[Days]] ≠ 0, then
1. Let _instant_ be ! CreateTemporalInstant(_zonedRelativeTo_.[[Nanoseconds]]).
1. Let _precalculatedPlainDateTime_ be ? GetPlainDateTimeFor(_timeZoneRec_, _instant_, _calendarRec_.[[Receiver]]).
@@ -475,23 +473,7 @@ Temporal.Duration.prototype.round ( _roundTo_ )
1. Let _calendarRec_ be *undefined*.
1. If _zonedRelativeTo_ is not *undefined* or _plainRelativeTo_ is not *undefined*, then
1. If _zonedRelativeTo_ is not *undefined*, let _calendar_ be _zonedRelativeTo_.[[Calendar]]; else let _calendar_ be _plainRelativeTo_.[[Calendar]].
- 1. Set _calendarRec_ to ! CreateCalendarMethodsRecord(_calendar_, « »).
- 1. If _largestUnit_ is *"year"*, or _largestUnit_ is *"month"*, or _largestUnit_ is *"week"*, let _largestUnitIsCalendarUnit_ be *true*; else let _largestUnitIsCalendarUnit_ be *false*.
- 1. If _smallestUnit_ is *"year"*, or _smallestUnit_ is *"month"*, or _smallestUnit_ is *"week"*, let _smallestUnitIsCalendarUnit_ be *true*; else let _smallestUnitIsCalendarUnit_ be *false*.
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or _largestUnitIsCalendarUnit_ is *true*, or _smallestUnitIsCalendarUnit_ is *true*; then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. Let _dateUntilMayBeCalled_ be *false*.
- 1. If _largestUnit_ is *"year"*, set _dateUntilMayBeCalled_ to *true*.
- 1. If _largestUnit_ is *"month"* and _duration_.[[Years]] ≠ 0, set _dateUntilMayBeCalled_ to *true*.
- 1. If _smallestUnit_ is *"year"*, set _dateUntilMayBeCalled_ to *true*.
- 1. Let _dateUntilMayBeCalledInAdjustDurationEdgeCase_ be *true*.
- 1. If _zonedRelativeTo_ is *undefined*, set _dateUntilMayBeCalledInAdjustDurationEdgeCase_ to *false*.
- 1. If _roundingGranularityIsNoop_ is *true*, set _dateUntilMayBeCalledInAdjustDurationEdgeCase_ to *false*.
- 1. If _smallestUnitIsCalendarUnit_ is *true*, set _dateUntilMayBeCalledInAdjustDurationEdgeCase_ to *false*.
- 1. If _largestUnitIsCalendarUnit_ is *false*, set _dateUntilMayBeCalledInAdjustDurationEdgeCase_ to *false*.
- 1. If _dateUntilMayBeCalledInAdjustDurationEdgeCase_ is *true*, set _dateUntilMayBeCalled_ to *true*.
- 1. If _dateUntilMayBeCalled_ is *true*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
+ 1. Set _calendarRec_ to ? CreateCalendarMethodsRecord(_calendar_, « ~dateAdd~, ~dateUntil~ »).
1. Let _unbalanceResult_ be ? UnbalanceDateDurationRelative(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _largestUnit_, _plainRelativeTo_, _calendarRec_).
1. Let _roundRecord_ be ? RoundDuration(_unbalanceResult_.[[Years]], _unbalanceResult_.[[Months]], _unbalanceResult_.[[Weeks]], _unbalanceResult_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _roundingIncrement_, _smallestUnit_, _roundingMode_, _plainRelativeTo_, _calendarRec_, _zonedRelativeTo_, _timeZoneRec_, _precalculatedPlainDateTime_).
1. Let _roundResult_ be _roundRecord_.[[DurationRecord]].
@@ -536,11 +518,7 @@ Temporal.Duration.prototype.total ( _totalOf_ )
1. Let _calendarRec_ be *undefined*.
1. If _zonedRelativeTo_ is not *undefined* and _plainRelativeTo_ is not *undefined*, then
1. If _zonedRelativeTo_ is not *undefined*, let _calendar_ be _zonedRelativeTo_.[[Calendar]]; else let _calendar_ be _plainRelativeTo_.[[Calendar]].
- 1. Set _calendarRec_ to ! CreateCalendarMethodsRecord(_calendar_, « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or _unit_ is *"year"*, or _unit_ is *"month"*, or _unit_ is *"week"*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. If _unit_ is *"year"*, or _unit_ is *"month"* and _duration_.[[Years]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
+ 1. Set _calendarRec_ to ? CreateCalendarMethodsRecord(_calendar_, « ~dateAdd~, ~dateUntil~ »).
1. Let _unbalanceResult_ be ? UnbalanceDateDurationRelative(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _unit_, _plainRelativeTo_, _calendarRec_).
1. If _zonedRelativeTo_ is not *undefined*, then
1. Let _intermediate_ be ? MoveRelativeZonedDateTime(_zonedRelativeTo_, _calendarRec_, _timeZoneRec_, _unbalanceResult_.[[Years]], _unbalanceResult_.[[Months]], _unbalanceResult_.[[Weeks]], 0, _precalculatedPlainDateTime_).
@@ -2024,11 +2002,7 @@
1. Let _calendarRec_ be *undefined*.
1. If _zonedRelativeTo_ is not *undefined* and _plainRelativeTo_ is not *undefined*, then
1. If _zonedRelativeTo_ is not *undefined*, let _calendar_ be _zonedRelativeTo_.[[Calendar]]; else let _calendar_ be _plainRelativeTo_.[[Calendar]].
- 1. Set _calendarRec_ to ! CreateCalendarMethodsRecord(_calendar_, « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, or _other_.[[Years]] ≠ 0, or _other_.[[Months]] ≠ 0, or _other_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. If _other_.[[Years]] ≠ 0, or _other_.[[Months]] ≠ 0, or _other_.[[Weeks]] ≠ 0, or _other_.[[Days]] ≠ 0, or _other_.[[Hours]] ≠ 0, or _other_.[[Minutes]] ≠ 0, or _other_.[[Seconds]] ≠ 0, or _other_.[[Milliseconds]] ≠ 0, or _other_.[[Microseconds]] ≠ 0, or _other_.[[Nanoseconds]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
+ 1. Set _calendarRec_ to ? CreateCalendarMethodsRecord(_calendar_, « ~dateAdd~, ~dateUntil~ »).
1. Let _result_ be ? AddDuration(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _sign_ × _other_.[[Years]], _sign_ × _other_.[[Months]], _sign_ × _other_.[[Weeks]], _sign_ × _other_.[[Days]], _sign_ × _other_.[[Hours]], _sign_ × _other_.[[Minutes]], _sign_ × _other_.[[Seconds]], _sign_ × _other_.[[Milliseconds]], _sign_ × _other_.[[Microseconds]], _sign_ × _other_.[[Nanoseconds]], _plainRelativeTo_, _calendarRec_, _zonedRelativeTo_, _timeZoneRec_).
1. Return ! CreateTemporalDuration(_result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]).
diff --git a/spec/plaindate.html b/spec/plaindate.html
index e0198dfb4e..f70484a42d 100644
--- a/spec/plaindate.html
+++ b/spec/plaindate.html
@@ -377,9 +377,7 @@ Temporal.PlainDate.prototype.add ( _temporalDurationLike_ [ , _options_ ] )<
1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]).
1. Let _duration_ be ? ToTemporalDuration(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « ~dateAdd~ »).
1. Return ? AddDate(_calendarRec_, _temporalDate_, _duration_, _options_).
@@ -395,9 +393,7 @@ Temporal.PlainDate.prototype.subtract ( _temporalDurationLike_ [ , _options_
1. Let _duration_ be ? ToTemporalDuration(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
1. Let _negatedDuration_ be ! CreateNegatedTemporalDuration(_duration_).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « ~dateAdd~ »).
1. Return ? AddDate(_calendarRec_, _temporalDate_, _negatedDuration_, _options_).
@@ -1010,6 +1006,7 @@
+ 1. Assert: CalendarMethodsRecordHasLookedUp(_calendarRec_, ~dateAdd~) is *true*.
1. If _options_ is not present, set _options_ to *undefined*.
1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
1. Return ? CalendarDateAdd(_calendarRec_, _plainDate_, _duration_, _options_).
@@ -1054,11 +1051,7 @@
1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « », *"day"*, *"day"*).
1. If _temporalDate_.[[ISOYear]] = _other_.[[ISOYear]], and _temporalDate_.[[ISOMonth]] = _other_.[[ISOMonth]], and _temporalDate_.[[ISODay]] = _other_.[[ISODay]], then
1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « »).
- 1. If _settings_.[[SmallestUnit]] is *"year"*, or _settings_.[[SmallestUnit]] is *"month"*, or _settings_.[[SmallestUnit]] is *"week"*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. If _settings_.[[LargestUnit]] is *"year"*, or _settings_.[[LargestUnit]] is *"month"*, or _settings_.[[LargestUnit]] is *"week"*, or _settings_.[[SmallestUnit]] is *"year"*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_temporalDate_.[[Calendar]], « ~dateAdd~, ~dateUntil~ »).
1. Perform ! CreateDataPropertyOrThrow(_resolvedOptions_, *"largestUnit"*, _settings_.[[LargestUnit]]).
1. Let _result_ be ? DifferenceDate(_calendarRec_, _temporalDate_, _other_, _resolvedOptions_).
1. If _settings_.[[SmallestUnit]] is not *"day"* or _settings_.[[RoundingIncrement]] ≠ 1, then
diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html
index 5f5066aaab..9f0975cb4a 100644
--- a/spec/plaindatetime.html
+++ b/spec/plaindatetime.html
@@ -1303,13 +1303,7 @@
1. Set _datePartsIdentical_ to *true*.
1. If _datePartsIdentical_ is *true*, and _dateTime_.[[ISOHour]] = _other_.[[ISOHour]], and _dateTime_.[[ISOMinute]] = _other_.[[ISOMinute]], and _dateTime_.[[ISOSecond]] = _other_.[[ISOSecond]], and _dateTime_.[[ISOMillisecond]] = _other_.[[ISOMillisecond]], and _dateTime_.[[ISOMicrosecond]] = _other_.[[ISOMicrosecond]], and _dateTime_.[[ISONanosecond]] = _other_.[[ISONanosecond]], then
1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « »).
- 1. If _settings_.[[SmallestUnit]] is *"year"*, or _settings_.[[SmallestUnit]] is *"month"*, or _settings_.[[SmallestUnit]] is *"week"*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. If _settings_.[[LargestUnit]] is *"year"*, or _settings_.[[LargestUnit]] is *"month"*, or _settings_.[[LargestUnit]] is *"week"*, let _largestUnitIsCalendarUnit_ be *true*; else let _largestUnitIsCalendarUnit_ be *false*.
- 1. If _datePartsIdentical_ is *false* and _largestUnitIsCalendarUnit_ is *true*, let _largestUnitRequiresDateUntilLookup_ be *true*; else let _largestUnitRequiresDateUntilLookup_ be *false*.
- 1. If _largestUnitRequiresDateUntilLookup_ is *true*, or _settings_.[[SmallestUnit]] is *"year"*, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « ~dateAdd~, ~dateUntil~ »).
1. Let _diff_ be ? DifferenceISODateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _calendarRec_, _settings_.[[LargestUnit]], _resolvedOptions_).
1. If _settings_.[[SmallestUnit]] is *"nanosecond"* and _settings_.[[RoundingIncrement]] is 1, then
1. Return ! CreateTemporalDuration(_sign_ × _diff_.[[Years]], _sign_ × _diff_.[[Months]], _sign_ × _diff_.[[Weeks]], _sign_ × _diff_.[[Days]], _sign_ × _diff_.[[Hours]], _sign_ × _diff_.[[Minutes]], _sign_ × _diff_.[[Seconds]], _sign_ × _diff_.[[Milliseconds]], _sign_ × _diff_.[[Microseconds]], _sign_ × _diff_.[[Nanoseconds]]).
@@ -1337,9 +1331,7 @@
1. If _operation_ is ~subtract~, let _sign_ be -1. Otherwise, let _sign_ be 1.
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_dateTime_.[[Calendar]], « ~dateAdd~ »).
1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]], _options_).
1. Assert: IsValidISODate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*.
1. Assert: IsValidTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*.
diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html
index 5e677da571..223245bb83 100644
--- a/spec/plainyearmonth.html
+++ b/spec/plainyearmonth.html
@@ -641,12 +641,7 @@
1. If _yearMonth_.[[ISOYear]] = _other_.[[ISOYear]] and _yearMonth_.[[ISOMonth]] = _other_.[[ISOMonth]] and _yearMonth_.[[ISODay]] = _other_.[[ISODay]], then
1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0).
1. Perform ! CreateDataPropertyOrThrow(_resolvedOptions_, *"largestUnit"*, _settings_.[[LargestUnit]]).
- 1. Let _calendarRec_ be ! CreateCalendarMethodsRecord(_calendar_, « »).
- 1. If _settings_.[[SmallestUnit]] is not *"month"* or _settings_.[[RoundingIncrement]] ≠ 1, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateFromFields~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateUntil~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~fields~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_calendar_, « ~dateAdd~, ~dateFromFields~, ~dateUntil~, ~fields~ »).
1. Let _fieldNames_ be ? CalendarFields(_calendarRec_, « *"monthCode"*, *"year"* »).
1. Let _thisFields_ be ? PrepareTemporalFields(_yearMonth_, _fieldNames_, «»).
1. Perform ! CreateDataPropertyOrThrow(_thisFields_, *"day"*, *1*𝔽).
@@ -681,13 +676,7 @@
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. 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]], « »).
- 1. If _sign_ < 0, or _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateFromFields~).
- 1. If _sign_ < 0, perform ? CalendarMethodsRecordLookup(_calendarRec_, ~day~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~fields~).
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~yearMonthFromFields~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_yearMonth_.[[Calendar]], « ~dateAdd~, ~dateFromFields~, ~day~, ~fields~, ~yearMonthFromFields~ »).
1. Let _fieldNames_ be ? CalendarFields(_calendarRec_, « *"monthCode"*, *"year"* »).
1. Let _fields_ be ? PrepareTemporalFields(_yearMonth_, _fieldNames_, «»).
1. Let _fieldsCopy_ be ! SnapshotOwnProperties(_fields_, *null*).
diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html
index 69084a59e1..9540f3d949 100644
--- a/spec/zoneddatetime.html
+++ b/spec/zoneddatetime.html
@@ -1542,9 +1542,7 @@
1. Let _duration_ be ? ToTemporalDurationRecord(_temporalDurationLike_).
1. Set _options_ to ? GetOptionsObject(_options_).
1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_zonedDateTime_.[[TimeZone]], « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »).
- 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_zonedDateTime_.[[Calendar]], « »).
- 1. If _duration_.[[Years]] ≠ 0, or _duration_.[[Months]] ≠ 0, or _duration_.[[Weeks]] ≠ 0, then
- 1. Perform ? CalendarMethodsRecordLookup(_calendarRec_, ~dateAdd~).
+ 1. Let _calendarRec_ be ? CreateCalendarMethodsRecord(_zonedDateTime_.[[Calendar]], « ~dateAdd~ »).
1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZoneRec_, _calendarRec_, _sign_ × _duration_.[[Years]], _sign_ × _duration_.[[Months]], _sign_ × _duration_.[[Weeks]], _sign_ × _duration_.[[Days]], _sign_ × _duration_.[[Hours]], _sign_ × _duration_.[[Minutes]], _sign_ × _duration_.[[Seconds]], _sign_ × _duration_.[[Milliseconds]], _sign_ × _duration_.[[Microseconds]], _sign_ × _duration_.[[Nanoseconds]], *undefined*, _options_).
1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZoneRec_.[[Receiver]], _calendarRec_.[[Receiver]]).