diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index ad191df34..af7a4f2c9 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -3636,6 +3636,10 @@ export function GetDifferenceSettings(op, options, group, disallowed, fallbackSm ]); let largestUnit = GetTemporalUnitValuedOption(options, 'largestUnit'); + const roundingIncrement = GetRoundingIncrementOption(options); + let roundingMode = GetRoundingModeOption(options, 'trunc'); + let smallestUnit = GetTemporalUnitValuedOption(options, 'smallestUnit'); + ValidateTemporalUnitValue(largestUnit, group, ['auto']); if (!largestUnit) largestUnit = 'auto'; if (Call(ArrayPrototypeIncludes, disallowed, [largestUnit])) { @@ -3644,12 +3648,8 @@ export function GetDifferenceSettings(op, options, group, disallowed, fallbackSm ); } - const roundingIncrement = GetRoundingIncrementOption(options); - - let roundingMode = GetRoundingModeOption(options, 'trunc'); if (op === 'since') roundingMode = NegateRoundingMode(roundingMode); - let smallestUnit = GetTemporalUnitValuedOption(options, 'smallestUnit'); ValidateTemporalUnitValue(smallestUnit, group); if (!smallestUnit) smallestUnit = fallbackSmallest; if (Call(ArrayPrototypeIncludes, disallowed, [smallestUnit])) { diff --git a/polyfill/lib/instant.mjs b/polyfill/lib/instant.mjs index 0e63d276f..8198643a8 100644 --- a/polyfill/lib/instant.mjs +++ b/polyfill/lib/instant.mjs @@ -109,9 +109,9 @@ export class Instant { const digits = ES.GetTemporalFractionalSecondDigitsOption(resolvedOptions); const roundingMode = ES.GetRoundingModeOption(resolvedOptions, 'trunc'); const smallestUnit = ES.GetTemporalUnitValuedOption(resolvedOptions, 'smallestUnit'); + let timeZone = resolvedOptions.timeZone; ES.ValidateTemporalUnitValue(smallestUnit, 'time'); if (smallestUnit === 'hour') throw new RangeErrorCtor('smallestUnit must be a time unit other than "hour"'); - let timeZone = resolvedOptions.timeZone; if (timeZone !== undefined) timeZone = ES.ToTemporalTimeZoneIdentifier(timeZone); const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits); const ns = GetSlot(this, EPOCHNANOSECONDS); diff --git a/polyfill/lib/zoneddatetime.mjs b/polyfill/lib/zoneddatetime.mjs index ea38f5f9a..a1a236976 100644 --- a/polyfill/lib/zoneddatetime.mjs +++ b/polyfill/lib/zoneddatetime.mjs @@ -349,9 +349,9 @@ export class ZonedDateTime { const showOffset = ES.GetTemporalShowOffsetOption(resolvedOptions); const roundingMode = ES.GetRoundingModeOption(resolvedOptions, 'trunc'); const smallestUnit = ES.GetTemporalUnitValuedOption(resolvedOptions, 'smallestUnit'); + const showTimeZone = ES.GetTemporalShowTimeZoneNameOption(resolvedOptions); ES.ValidateTemporalUnitValue(smallestUnit, 'time'); if (smallestUnit === 'hour') throw new RangeErrorCtor('smallestUnit must be a time unit other than "hour"'); - const showTimeZone = ES.GetTemporalShowTimeZoneNameOption(resolvedOptions); const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits); return ES.TemporalZonedDateTimeToString(this, precision, showCalendar, showTimeZone, showOffset, { unit, diff --git a/spec/abstractops.html b/spec/abstractops.html index 226198acf..30735c3f7 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -1866,15 +1866,15 @@