From 8ce1f54d0c0da25d58b08ac149a588502e653a7d Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 10 Nov 2023 13:36:23 -0800 Subject: [PATCH] Post-adjustment: Make time zone method lookups unconditional This is to address a belated review comment from Richard on #2519. For each operation in which we need to observably look up time zone methods, make those lookups unconditional for every method that might be called. See: #2724 --- polyfill/lib/ecmascript.mjs | 21 +++------------------ polyfill/lib/intl.mjs | 25 ++++++++++++++++++++----- polyfill/lib/plaindate.mjs | 2 +- polyfill/lib/plaindatetime.mjs | 2 +- polyfill/lib/plaintime.mjs | 2 +- polyfill/lib/timezone.mjs | 2 +- spec/intl.html | 10 +++++----- spec/plaindate.html | 2 +- spec/plaindatetime.html | 2 +- spec/plaintime.html | 2 +- spec/timezone.html | 10 +++------- spec/zoneddatetime.html | 14 +++----------- 12 files changed, 41 insertions(+), 53 deletions(-) diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 604f91aa48..ba90244f19 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -1475,9 +1475,7 @@ export function InterpretISODateTimeOffset( offsetOpt, matchMinute ) { - // If offsetBehaviour !== "exact" and offsetOpt !== "use", at least - // getPossibleInstantsFor should be looked up in advance. timeZoneRec may be - // modified by looking up getOffsetNanosecondsFor as needed. + // getPossibleInstantsFor and getOffsetNanosecondsFor should be looked up. const dt = CreateTemporalDateTime( year, month, @@ -1522,7 +1520,6 @@ export function InterpretISODateTimeOffset( // "prefer" or "reject" const possibleInstants = GetPossibleInstantsFor(timeZoneRec, dt); if (possibleInstants.length > 0) { - if (!timeZoneRec.hasLookedUp('getOffsetNanosecondsFor')) timeZoneRec.lookup('getOffsetNanosecondsFor'); for (let index = 0; index < possibleInstants.length; index++) { const candidate = possibleInstants[index]; const candidateOffset = GetOffsetNanosecondsFor(timeZoneRec, candidate); @@ -1544,7 +1541,6 @@ export function InterpretISODateTimeOffset( } // fall through: offsetOpt === 'prefer', but the offset doesn't match // so fall back to use the time zone instead. - if (!timeZoneRec.hasLookedUp('getOffsetNanosecondsFor')) timeZoneRec.lookup('getOffsetNanosecondsFor'); const instant = DisambiguatePossibleInstants(possibleInstants, timeZoneRec, dt, disambiguation); return GetSlot(instant, EPOCHNANOSECONDS); } @@ -1616,10 +1612,7 @@ export function ToTemporalZonedDateTime(item, options) { } let offsetNs = 0; if (offsetBehaviour === 'option') offsetNs = ParseDateTimeUTCOffset(offset); - const timeZoneRec = new TimeZoneMethodRecord(timeZone); - if (offsetBehaviour !== 'exact' && offsetOpt !== 'use') { - timeZoneRec.lookup('getPossibleInstantsFor'); - } + const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getOffsetNanosecondsFor', 'getPossibleInstantsFor']); const epochNanoseconds = InterpretISODateTimeOffset( year, month, @@ -2375,16 +2368,8 @@ export function GetPlainDateTimeFor(timeZoneRec, instant, calendar, precalculate } export function GetInstantFor(timeZoneRec, dateTime, disambiguation) { - // getPossibleInstantsFor must be looked up already. - // getOffsetNanosecondsFor _may_ be looked up and timeZoneRec may be modified. + // getPossibleInstantsFor and getOffsetNanosecondsFor must be looked up. const possibleInstants = GetPossibleInstantsFor(timeZoneRec, dateTime); - if ( - possibleInstants.length === 0 && - disambiguation !== 'reject' && - !timeZoneRec.hasLookedUp('getOffsetNanosecondsFor') - ) { - timeZoneRec.lookup('getOffsetNanosecondsFor'); - } return DisambiguatePossibleInstants(possibleInstants, timeZoneRec, dateTime, disambiguation); } diff --git a/polyfill/lib/intl.mjs b/polyfill/lib/intl.mjs index f4b837529c..c78223ed4a 100644 --- a/polyfill/lib/intl.mjs +++ b/polyfill/lib/intl.mjs @@ -365,7 +365,10 @@ function extractOverrides(temporalObj, main) { nanosecond, 'iso8601' ); - const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], [ + 'getOffsetNanosecondsFor', + 'getPossibleInstantsFor' + ]); return { instant: ES.GetInstantFor(timeZoneRec, datetime, 'compatible'), formatter: getPropLazy(main, TIME) @@ -383,7 +386,10 @@ function extractOverrides(temporalObj, main) { ); } const datetime = ES.CreateTemporalDateTime(isoYear, isoMonth, referenceISODay, 12, 0, 0, 0, 0, 0, calendar); - const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], [ + 'getOffsetNanosecondsFor', + 'getPossibleInstantsFor' + ]); return { instant: ES.GetInstantFor(timeZoneRec, datetime, 'compatible'), formatter: getPropLazy(main, YM) @@ -401,7 +407,10 @@ function extractOverrides(temporalObj, main) { ); } const datetime = ES.CreateTemporalDateTime(referenceISOYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0, calendar); - const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], [ + 'getOffsetNanosecondsFor', + 'getPossibleInstantsFor' + ]); return { instant: ES.GetInstantFor(timeZoneRec, datetime, 'compatible'), formatter: getPropLazy(main, MD) @@ -417,7 +426,10 @@ function extractOverrides(temporalObj, main) { throw new RangeError(`cannot format PlainDate with calendar ${calendar} in locale with calendar ${main[CAL_ID]}`); } const datetime = ES.CreateTemporalDateTime(isoYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0, main[CAL_ID]); - const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], [ + 'getOffsetNanosecondsFor', + 'getPossibleInstantsFor' + ]); return { instant: ES.GetInstantFor(timeZoneRec, datetime, 'compatible'), formatter: getPropLazy(main, DATE) @@ -431,7 +443,10 @@ function extractOverrides(temporalObj, main) { `cannot format PlainDateTime with calendar ${calendar} in locale with calendar ${main[CAL_ID]}` ); } - const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(main[TZ_CANONICAL], [ + 'getOffsetNanosecondsFor', + 'getPossibleInstantsFor' + ]); return { instant: ES.GetInstantFor(timeZoneRec, temporalObj, 'compatible'), formatter: getPropLazy(main, DATETIME) diff --git a/polyfill/lib/plaindate.mjs b/polyfill/lib/plaindate.mjs index 8e0dd96f9d..06d4b695a7 100644 --- a/polyfill/lib/plaindate.mjs +++ b/polyfill/lib/plaindate.mjs @@ -258,7 +258,7 @@ export class PlainDate { nanosecond, calendar ); - const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getOffsetNanosecondsFor', 'getPossibleInstantsFor']); const instant = ES.GetInstantFor(timeZoneRec, dt, 'compatible'); return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar); } diff --git a/polyfill/lib/plaindatetime.mjs b/polyfill/lib/plaindatetime.mjs index da481246ee..31e6992593 100644 --- a/polyfill/lib/plaindatetime.mjs +++ b/polyfill/lib/plaindatetime.mjs @@ -411,7 +411,7 @@ export class PlainDateTime { const timeZone = ES.ToTemporalTimeZoneSlotValue(temporalTimeZoneLike); options = ES.GetOptionsObject(options); const disambiguation = ES.ToTemporalDisambiguation(options); - const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getOffsetNanosecondsFor', 'getPossibleInstantsFor']); const instant = ES.GetInstantFor(timeZoneRec, this, disambiguation); return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, GetSlot(this, CALENDAR)); } diff --git a/polyfill/lib/plaintime.mjs b/polyfill/lib/plaintime.mjs index c3d1aa64b4..5ef69299eb 100644 --- a/polyfill/lib/plaintime.mjs +++ b/polyfill/lib/plaintime.mjs @@ -292,7 +292,7 @@ export class PlainTime { nanosecond, calendar ); - const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(timeZone, ['getOffsetNanosecondsFor', 'getPossibleInstantsFor']); const instant = ES.GetInstantFor(timeZoneRec, dt, 'compatible'); return ES.CreateTemporalZonedDateTime(GetSlot(instant, EPOCHNANOSECONDS), timeZone, calendar); } diff --git a/polyfill/lib/timezone.mjs b/polyfill/lib/timezone.mjs index 9e3f51b800..37540521db 100644 --- a/polyfill/lib/timezone.mjs +++ b/polyfill/lib/timezone.mjs @@ -80,7 +80,7 @@ export class TimeZone { dateTime = ES.ToTemporalDateTime(dateTime); options = ES.GetOptionsObject(options); const disambiguation = ES.ToTemporalDisambiguation(options); - const timeZoneRec = new TimeZoneMethodRecord(this, ['getPossibleInstantsFor']); + const timeZoneRec = new TimeZoneMethodRecord(this, ['getOffsetNanosecondsFor', 'getPossibleInstantsFor']); return ES.GetInstantFor(timeZoneRec, dateTime, disambiguation); } getPossibleInstantsFor(dateTime) { diff --git a/spec/intl.html b/spec/intl.html index f617a5a17f..c9eadc4623 100644 --- a/spec/intl.html +++ b/spec/intl.html @@ -858,7 +858,7 @@

HandleDateTimeTemporalDate ( _dateTimeFormat_, _temporalDate_ )

1. Let _calendar_ be ? ToTemporalCalendarIdentifier(_temporalDate_.[[Calendar]]). 1. If _calendar_ is not _dateTimeFormat_.[[Calendar]] or *"iso8601"*, throw a *RangeError* exception. 1. Let _plainDateTime_ be ? CreateTemporalDateTime(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], 12, 0, 0, 0, 0, 0, _dateTimeFormat_.[[Calendar]]). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _plainDateTime_, *"compatible"*). 1. If _pattern_ is *null*, throw a *TypeError* exception. 1. Return the Record { @@ -884,7 +884,7 @@

HandleDateTimeTemporalYearMonth ( _dateTimeFormat_, _temporalYearMonth_ )HandleDateTimeTemporalMonthDay ( _dateTimeFormat_, _temporalMonthDay_ )

1. If _calendar_ is not equal to _dateTimeFormat_.[[Calendar]], then 1. Throw a *RangeError* exception. 1. Let _plainDateTime_ be ? CreateTemporalDateTime(_temporalMonthDay_.[[ISOYear]], _temporalMonthDay_.[[ISOMonth]], _temporalMonthDay_.[[ISODay]], 12, 0, 0, 0, 0, 0, _dateTimeFormat_.[[Calendar]]). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _plainDateTime_, *"compatible"*). 1. If _pattern_ is *null*, throw a *TypeError* exception. 1. Return the Record { @@ -935,7 +935,7 @@

HandleDateTimeTemporalTime ( _dateTimeFormat_, _temporalTime_ )

1. Assert: _temporalTime_ has an [[InitializedTemporalTime]] internal slot. 1. Let _pattern_ be _dateTimeFormat_.[[TemporalPlainTimePattern]]. 1. Let _plainDateTime_ be ? CreateTemporalDateTime(1970, 1, 1, _temporalTime_.[[ISOHour]], _temporalTime_.[[ISOMinute]], _temporalTime_.[[ISOSecond]], _temporalTime_.[[ISOMillisecond]], _temporalTime_.[[ISOMicrosecond]], _temporalTime_.[[ISONanosecond]], *"iso8601"*). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _plainDateTime_, *"compatible"*). 1. If _pattern_ is *null*, throw a *TypeError* exception. 1. Return the Record { @@ -961,7 +961,7 @@

HandleDateTimeTemporalDateTime ( _dateTimeFormat_, _dateTime_ )

1. Let _calendar_ be ? ToTemporalCalendarIdentifier(_dateTime_.[[Calendar]]). 1. If _calendar_ is not *"iso8601"* and not equal to _dateTimeFormat_.[[Calendar]], then 1. Throw a *RangeError* exception. - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_dateTimeFormat_.[[TimeZone]], « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _dateTime_, *"compatible"*). 1. If _pattern_ is *null*, throw a *TypeError* exception. 1. Return the Record { diff --git a/spec/plaindate.html b/spec/plaindate.html index 609e816208..e50985efef 100644 --- a/spec/plaindate.html +++ b/spec/plaindate.html @@ -523,7 +523,7 @@

Temporal.PlainDate.prototype.toZonedDateTime ( _item_ )

1. Else, 1. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_). 1. Let _temporalDateTime_ be ? CreateTemporalDateTime(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], _temporalTime_.[[ISOHour]], _temporalTime_.[[ISOMinute]], _temporalTime_.[[ISOSecond]], _temporalTime_.[[ISOMillisecond]], _temporalTime_.[[ISOMicrosecond]], _temporalTime_.[[ISONanosecond]], _temporalDate_.[[Calendar]]). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _temporalDateTime_, *"compatible"*). 1. Return ! CreateTemporalZonedDateTime(_instant_.[[Nanoseconds]], _timeZone_, _temporalDate_.[[Calendar]]). diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html index 3d11e0aff8..1640bd71f1 100644 --- a/spec/plaindatetime.html +++ b/spec/plaindatetime.html @@ -632,7 +632,7 @@

Temporal.PlainDateTime.prototype.toZonedDateTime ( _temporalTimeZoneLike_ [ 1. Let _timeZone_ be ? ToTemporalTimeZoneSlotValue(_temporalTimeZoneLike_). 1. Set _options_ to ? GetOptionsObject(_options_). 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _dateTime_, _disambiguation_). 1. Return ! CreateTemporalZonedDateTime(_instant_.[[Nanoseconds]], _timeZone_, _dateTime_.[[Calendar]]). diff --git a/spec/plaintime.html b/spec/plaintime.html index a09154b985..59ff03333e 100644 --- a/spec/plaintime.html +++ b/spec/plaintime.html @@ -358,7 +358,7 @@

Temporal.PlainTime.prototype.toZonedDateTime ( _item_ )

1. Throw a *TypeError* exception. 1. Let _timeZone_ be ? ToTemporalTimeZoneSlotValue(_temporalTimeZoneLike_). 1. Let _temporalDateTime_ be ? CreateTemporalDateTime(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], _temporalTime_.[[ISOHour]], _temporalTime_.[[ISOMinute]], _temporalTime_.[[ISOSecond]], _temporalTime_.[[ISOMillisecond]], _temporalTime_.[[ISOMicrosecond]], _temporalTime_.[[ISONanosecond]], _temporalDate_.[[Calendar]]). - 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getPossibleInstantsFor~ »). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _temporalDateTime_, *"compatible"*). 1. Return ! CreateTemporalZonedDateTime(_instant_.[[Nanoseconds]], _timeZone_, _temporalDate_.[[Calendar]]). diff --git a/spec/timezone.html b/spec/timezone.html index 6cf8a28c20..773f12077f 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -173,7 +173,7 @@

Temporal.TimeZone.prototype.getInstantFor ( _dateTime_ [ , _options_ ] )

@@ -887,14 +887,10 @@

If that call returns an empty array and _disambiguation_ is not *"reject"*, it calls _timeZoneRec_'s `getOffsetNanosecondsFor` method twice, and `getPossibleInstantsFor` an additional time. -

- _timeZoneRec_ must have looked up at least the `getPossibleInstantsFor` method. - `getOffsetNanosecondsFor` will be looked up as needed, since this is one of the few operations that cannot determine in advance whether it will be used. -

+ 1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getOffsetNanosecondsFor~) is *true*. + 1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getPossibleInstantsFor~) is *true*. 1. Let _possibleInstants_ be ? GetPossibleInstantsFor(_timeZoneRec_, _dateTime_). - 1. If _possibleInstants_ is empty, and _disambiguation_ is not *"reject"*, and TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getOffsetNanosecondsFor~) is *false*, then - 1. Perform ? TimeZoneMethodsRecordLookup(_timeZoneRec_, ~getOffsetNanosecondsFor~). 1. Return ? DisambiguatePossibleInstants(_possibleInstants_, _timeZoneRec_, _dateTime_, _disambiguation_). diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html index e2c298841b..6c34f13310 100644 --- a/spec/zoneddatetime.html +++ b/spec/zoneddatetime.html @@ -1115,16 +1115,14 @@

As a special case when parsing ISO 8601 strings which are only required to specify time zone offsets to minutes precision, if _matchBehaviour_ is ~match minutes~, then a value for _offsetNanoseconds_ that is rounded to the nearest minute will be accepted in those cases where _offsetNanoseconds_ is compared against _timeZone_'s offset. If _matchBehaviour_ is ~match exactly~, then this does not happen.

-

- The _timeZoneRec_ will look up `getOffsetNanosecondsFor` as needed, since this is one of the few operations that cannot determine in advance whether it will be used. -

1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*. + 1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getOffsetNanosecondsFor~) is *true*. + 1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getPossibleInstantsFor~) is *true*. 1. Let _dateTime_ be ? CreateTemporalDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, *"iso8601"*). 1. If _offsetBehaviour_ is ~wall~ or _offsetOption_ is *"ignore"*, then - 1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getPossibleInstantsFor~) is *true*. 1. Let _instant_ be ? GetInstantFor(_timeZoneRec_, _dateTime_, _disambiguation_). 1. Return _instant_.[[Nanoseconds]]. 1. If _offsetBehaviour_ is ~exact~ or _offsetOption_ is *"use"*, then @@ -1136,8 +1134,6 @@

1. Assert: TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getPossibleInstantsFor~) is *true*. 1. Let _possibleInstants_ be ? GetPossibleInstantsFor(_timeZoneRec_, _dateTime_). 1. If _possibleInstants_ is not empty, then - 1. If TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getOffsetNanosecondsFor~) is *false*, then - 1. Perform ? TimeZoneMethodsRecordLookup(_timeZoneRec_, ~getOffsetNanosecondsFor~). 1. For each element _candidate_ of _possibleInstants_, do 1. Let _candidateNanoseconds_ be ? GetOffsetNanosecondsFor(_timeZoneRec_, _candidate_). 1. If _candidateNanoseconds_ = _offsetNanoseconds_, then @@ -1147,8 +1143,6 @@

1. If _roundedCandidateNanoseconds_ = _offsetNanoseconds_, then 1. Return _candidate_.[[Nanoseconds]]. 1. If _offsetOption_ is *"reject"*, throw a *RangeError* exception. - 1. If TimeZoneMethodsRecordHasLookedUp(_timeZoneRec_, ~getOffsetNanosecondsFor~) is *false*, then - 1. Perform ? TimeZoneMethodsRecordLookup(_timeZoneRec_, ~getOffsetNanosecondsFor~). 1. Let _instant_ be ? DisambiguatePossibleInstants(_possibleInstants_, _timeZoneRec_, _dateTime_, _disambiguation_). 1. Return _instant_.[[Nanoseconds]]. @@ -1212,9 +1206,7 @@

1. Let _offsetNanoseconds_ be 0. 1. If _offsetBehaviour_ is ~option~, then 1. Set _offsetNanoseconds_ to ? ParseDateTimeUTCOffset(_offsetString_). - 1. Let _timeZoneRec_ be ! CreateTimeZoneMethodsRecord(_timeZone_, « »). - 1. If _offsetBehaviour_ is not ~exact~, and _offsetOption_ is not *"use"*, then - 1. Perform ? TimeZoneMethodsRecordLookup(_timeZoneRec_, ~getPossibleInstantsFor~). + 1. Let _timeZoneRec_ be ? CreateTimeZoneMethodsRecord(_timeZone_, « ~getOffsetNanosecondsFor~, ~getPossibleInstantsFor~ »). 1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _offsetBehaviour_, _offsetNanoseconds_, _timeZoneRec_, _disambiguation_, _offsetOption_, _matchBehaviour_). 1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_).