Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,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])) {
Expand All @@ -3631,12 +3635,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])) {
Expand Down
2 changes: 1 addition & 1 deletion polyfill/lib/instant.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion polyfill/lib/zoneddatetime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion polyfill/test262
Submodule test262 updated 47 files
+1 −1 test/built-ins/Iterator/concat/fresh-iterator-result.js
+29 −0 test/built-ins/Iterator/concat/get-value-after-done.js
+22 −0 test/built-ins/Temporal/Duration/compare/options-read-before-algorithmic-validation.js
+74 −0 test/built-ins/Temporal/Duration/prototype/round/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/Duration/prototype/toString/options-read-before-algorithmic-validation.js
+30 −0 test/built-ins/Temporal/Duration/prototype/total/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/Instant/prototype/round/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/Instant/prototype/since/options-read-before-algorithmic-validation.js
+38 −0 test/built-ins/Temporal/Instant/prototype/toString/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/Instant/prototype/until/options-read-before-algorithmic-validation.js
+26 −0 test/built-ins/Temporal/PlainDate/from/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDate/prototype/add/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainDate/prototype/since/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDate/prototype/subtract/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainDate/prototype/until/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDate/prototype/with/options-read-before-algorithmic-validation.js
+26 −0 test/built-ins/Temporal/PlainDateTime/from/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDateTime/prototype/add/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/PlainDateTime/prototype/round/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainDateTime/prototype/since/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDateTime/prototype/subtract/options-read-before-algorithmic-validation.js
+40 −0 test/built-ins/Temporal/PlainDateTime/prototype/toString/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainDateTime/prototype/until/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainDateTime/prototype/with/options-read-before-algorithmic-validation.js
+26 −0 test/built-ins/Temporal/PlainMonthDay/from/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainMonthDay/prototype/with/options-read-before-algorithmic-validation.js
+26 −0 test/built-ins/Temporal/PlainTime/from/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/PlainTime/prototype/round/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainTime/prototype/since/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/PlainTime/prototype/toString/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainTime/prototype/until/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainTime/prototype/with/options-read-before-algorithmic-validation.js
+26 −0 test/built-ins/Temporal/PlainYearMonth/from/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainYearMonth/prototype/add/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainYearMonth/prototype/since/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainYearMonth/prototype/subtract/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/PlainYearMonth/prototype/until/options-read-before-algorithmic-validation.js
+28 −0 test/built-ins/Temporal/PlainYearMonth/prototype/with/options-read-before-algorithmic-validation.js
+34 −0 test/built-ins/Temporal/ZonedDateTime/from/options-read-before-algorithmic-validation.js
+38 −0 test/built-ins/Temporal/ZonedDateTime/prototype/add/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/ZonedDateTime/prototype/round/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/ZonedDateTime/prototype/since/options-read-before-algorithmic-validation.js
+38 −0 test/built-ins/Temporal/ZonedDateTime/prototype/subtract/options-read-before-algorithmic-validation.js
+48 −0 test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-read-before-algorithmic-validation.js
+41 −0 test/built-ins/Temporal/ZonedDateTime/prototype/until/options-read-before-algorithmic-validation.js
+36 −0 test/built-ins/Temporal/ZonedDateTime/prototype/with/options-read-before-algorithmic-validation.js
6 changes: 3 additions & 3 deletions spec/abstractops.html
Original file line number Diff line number Diff line change
Expand Up @@ -1837,15 +1837,15 @@ <h1>
<emu-alg>
1. NOTE: The following steps read options and perform independent validation in alphabetical order.
1. Let _largestUnit_ be ? GetTemporalUnitValuedOption(_options_, *"largestUnit"*, ~unset~).
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_options_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_options_, ~trunc~).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_options_, *"smallestUnit"*, ~unset~).
1. Perform ? ValidateTemporalUnitValue(_largestUnit_, _unitGroup_, « ~auto~ »).
1. If _largestUnit_ is ~unset~, then
1. Set _largestUnit_ to ~auto~.
1. If _disallowedUnits_ contains _largestUnit_, throw a *RangeError* exception.
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_options_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_options_, ~trunc~).
1. If _operation_ is ~since~, then
1. Set _roundingMode_ to NegateRoundingMode(_roundingMode_).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_options_, *"smallestUnit"*, ~unset~).
1. Perform ? ValidateTemporalUnitValue(_smallestUnit_, _unitGroup_).
1. If _smallestUnit_ is ~unset~, then
1. Set _smallestUnit_ to _fallbackSmallestUnit_.
Expand Down
2 changes: 1 addition & 1 deletion spec/instant.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ <h1>Temporal.Instant.prototype.toString ( [ _options_ ] )</h1>
1. Let _digits_ be ? GetTemporalFractionalSecondDigitsOption(_resolvedOptions_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~unset~).
1. Let _timeZone_ be ? Get(_resolvedOptions_, *"timeZone"*).
1. Perform ? ValidateTemporalUnitValue(_smallestUnit_, ~time~).
1. If _smallestUnit_ is ~hour~, throw a *RangeError* exception.
1. Let _timeZone_ be ? Get(_resolvedOptions_, *"timeZone"*).
1. If _timeZone_ is not *undefined*, then
1. Set _timeZone_ to ? ToTemporalTimeZoneIdentifier(_timeZone_).
1. Let _precision_ be ToSecondsStringPrecisionRecord(_smallestUnit_, _digits_).
Expand Down
2 changes: 1 addition & 1 deletion spec/zoneddatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ <h1>Temporal.ZonedDateTime.prototype.toString ( [ _options_ ] )</h1>
1. Let _showOffset_ be ? GetTemporalShowOffsetOption(_resolvedOptions_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~unset~).
1. Let _showTimeZone_ be ? GetTemporalShowTimeZoneNameOption(_resolvedOptions_).
1. Perform ? ValidateTemporalUnitValue(_smallestUnit_, ~time~).
1. If _smallestUnit_ is ~hour~, throw a *RangeError* exception.
1. Let _showTimeZone_ be ? GetTemporalShowTimeZoneNameOption(_resolvedOptions_).
1. Let _precision_ be ToSecondsStringPrecisionRecord(_smallestUnit_, _digits_).
1. Return TemporalZonedDateTimeToString(_zonedDateTime_, _precision_.[[Precision]], _showCalendar_, _showTimeZone_, _showOffset_, _precision_.[[Increment]], _precision_.[[Unit]], _roundingMode_).
</emu-alg>
Expand Down