From 3d3800826d989220c07a57980c45940e75929f55 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 4 Sep 2020 16:27:34 -0700 Subject: [PATCH] Separate 'overflow' from 'disambiguation' "Overflow" is how to deal with out-of-range values for a particular unit (for example, minute 61, or day 0 of the month.) "Disambiguation" is how to deal with skipped or double wall clock times during time zone transitions. Previously, they were both called "disambiguation". This split is necessary, because for the zoned type being added, we will need to provide both options to the same function call. Closes: #607 --- docs/balancing.md | 42 +++--- docs/calendar.md | 12 +- docs/cookbook.md | 2 +- docs/cookbook/adjustMonth.mjs | 2 +- docs/date.md | 40 +++--- docs/datetime.md | 52 ++++---- docs/duration.md | 49 ++++--- docs/monthday.md | 26 ++-- docs/time.md | 28 ++-- docs/yearmonth.md | 40 +++--- polyfill/index.d.ts | 6 +- polyfill/lib/calendar.mjs | 24 ++-- polyfill/lib/date.mjs | 4 +- polyfill/lib/datetime.mjs | 14 +- polyfill/lib/duration.mjs | 16 +-- polyfill/lib/ecmascript.mjs | 46 +++---- polyfill/lib/monthday.mjs | 4 +- polyfill/lib/time.mjs | 16 +-- polyfill/lib/timezone.mjs | 2 +- polyfill/lib/yearmonth.mjs | 6 +- .../Date/constructor/from/infinity-handled.js | 24 ++-- .../from/negative-infinity-handled.js | 24 ++-- .../constructor/from/subclass-invalid-arg.js | 2 +- .../minus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../plus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../Date/prototype/with/infinity-handled.js | 24 ++-- .../with/negative-infinity-handled.js | 24 ++-- .../constructor/from/infinity-handled.js | 72 +++++------ .../from/negative-infinity-handled.js | 72 +++++------ .../constructor/from/subclass-invalid-arg.js | 2 +- .../minus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../plus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../prototype/with/infinity-handled.js | 72 +++++------ .../with/negative-infinity-handled.js | 72 +++++------ .../from/argument-existing-object.js | 2 +- .../constructor/from/infinity-handled.js | 120 +++++++++--------- .../from/negative-infinity-handled.js | 120 +++++++++--------- .../constructor/from/subclass-invalid-arg.js | 4 +- .../minus/infinity-throws-rangeerror.js | 120 +++++++++--------- .../negative-infinity-throws-rangeerror.js | 120 +++++++++--------- .../prototype/minus/subclass-out-of-range.js | 2 +- .../plus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../prototype/plus/subclass-out-of-range.js | 2 +- .../prototype/with/infinity-handled.js | 120 +++++++++--------- .../negative-infinity-throws-rangeerror.js | 120 +++++++++--------- .../prototype/with/subclass-out-of-range.js | 4 +- .../constructor/from/infinity-handled.js | 16 +-- .../from/negative-infinity-handled.js | 16 +-- .../constructor/from/subclass-invalid-arg.js | 6 +- .../prototype/with/infinity-handled.js | 16 +-- .../with/negative-infinity-handled.js | 16 +-- .../prototype/with/subclass-out-of-range.js | 2 +- .../Time/constructor/from/infinity-handled.js | 48 +++---- .../from/negative-infinity-handled.js | 48 +++---- .../constructor/from/subclass-invalid-arg.js | 4 +- .../minus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../plus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../Time/prototype/with/infinity-handled.js | 48 +++---- .../with/negative-infinity-handled.js | 48 +++---- .../constructor/from/infinity-handled.js | 16 +-- .../from/negative-infinity-handled.js | 16 +-- .../constructor/from/subclass-invalid-arg.js | 2 +- .../minus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../plus/infinity-throws-rangeerror.js | 80 ++++++------ .../negative-infinity-throws-rangeerror.js | 80 ++++++------ .../prototype/with/infinity-handled.js | 16 +-- .../with/negative-infinity-handled.js | 16 +-- polyfill/test/date.mjs | 68 +++++----- polyfill/test/datemath.mjs | 10 +- polyfill/test/datetime.mjs | 62 ++++----- polyfill/test/duration.mjs | 109 ++++++++-------- polyfill/test/monthday.mjs | 26 ++-- polyfill/test/time.mjs | 42 +++--- polyfill/test/usercalendar.mjs | 18 +-- polyfill/test/yearmonth.mjs | 68 +++++----- spec/abstractops.html | 16 +-- spec/date.html | 40 +++--- spec/datetime.html | 32 ++--- spec/duration.html | 32 ++--- spec/monthday.html | 22 ++-- spec/time.html | 22 ++-- spec/timezone.html | 2 +- spec/yearmonth.html | 30 ++--- 91 files changed, 1959 insertions(+), 1967 deletions(-) diff --git a/docs/balancing.md b/docs/balancing.md index e0c61fc4c4..5d20d23aa4 100644 --- a/docs/balancing.md +++ b/docs/balancing.md @@ -10,13 +10,13 @@ Take, for example, a duration of 100 seconds: `Temporal.Duration.from({ seconds: 100 seconds is equal to 1 minute and 40 seconds. Instead of clipping this to 59 seconds it's more likely that we would want to "balance" it, wrapping 60 seconds around to 0 to make 1 minute and 40 seconds. However, it's an equally valid use case to want to track the duration of something in seconds only, and not balance the duration to 1 minute and 40 seconds. -What is done with the duration depends on the `disambiguation` option when creating the `Temporal.Duration` object. +What is done with the duration depends on the `overflow` option when creating the `Temporal.Duration` object. Unlike with the other Temporal types, constrain mode doesn't clip the seconds value to 59, and reject mode doesn't throw. They just leave the value as it is. Balance mode lets you opt in to the balancing behaviour: ```javascript -d = Temporal.Duration.from({ seconds: 100 }, { disambiguation: 'balance' }); +d = Temporal.Duration.from({ seconds: 100 }, { overflow: 'balance' }); d.minutes // => 1 d.seconds // => 40 ``` @@ -28,7 +28,7 @@ No balancing is ever performed between years, months, and days, because such con If you need such a conversion, you must implement it yourself, since the rules can depend on the start date and the calendar in use. `Temporal.Duration` fields are not allowed to have mixed signs. -For example, passing one positive and one negative argument to `new Temporal.Duration()` or as properties in the object passed to `Temporal.Duration.from()` will always throw an exception, regardless of the disambiguation mode. +For example, passing one positive and one negative argument to `new Temporal.Duration()` or as properties in the object passed to `Temporal.Duration.from()` will always throw an exception, regardless of the overflow option. Therefore, the only case where constrain and reject mode have any effect when creating a duration, is integer overflow. If one of the values overflows, constrain mode will cap it to `Number.MAX_VALUE` or `-Number.MAX_VALUE`. @@ -49,7 +49,7 @@ It could further be balanced into 1 hour, 29 minutes, and 30 seconds. However, that would likely conflict with the intention of having a duration of 90 minutes in the first place, so this should be behaviour that the Temporal user opts in to. Here, we make a distinction between "necessary balancing" and "optional balancing". -In order to accommodate this, the `disambiguation` option when performing arithmetic on `Temporal.Duration`s is different from all the other arithmetic methods' disambiguation options. +In order to accommodate this, the `overflow` option when performing arithmetic on `Temporal.Duration`s is different from all the other arithmetic methods' overflow options. Necessary balancing is called `constrain` mode, because values are constrained to be non-negative through balancing. Optional balancing is called `balance` mode. The usual `reject` mode is also available, and does the same thing as `constrain` but throws on integer overflow. @@ -58,11 +58,11 @@ The default is `constrain` mode. The `balance` mode is only provided for convenience, since the following code snippets give the same result: ```javascript -duration3 = duration1.minus(duration2, { disambiguation: 'balance' }); +duration3 = duration1.minus(duration2, { overflow: 'balance' }); tmp = duration1.minus(duration2); -// duration3 = Temporal.Duration.from(tmp, { disambiguation: 'balance' }); - FIXME: https://github.com/tc39/proposal-temporal/issues/232 -duration3 = tmp.with(tmp, { disambiguation: 'balance' }); +duration3 = Temporal.Duration.from(tmp, { overflow: 'balance' }); +duration3 = tmp.with(tmp, { overflow: 'balance' }); ``` Here are some more examples of what each mode does: @@ -71,44 +71,44 @@ Here are some more examples of what each mode does: // Simple, no balancing possible one = Temporal.Duration.from({ hours: 3 }); two = Temporal.Duration.from({ hours: 1 }); -one.minus(two); // => PT2H -one.minus(two, { disambiguation: 'balance' }); // => PT2H +one.minus(two); // => PT2H +one.minus(two, { overflow: 'balance' }); // => PT2H // Balancing possible but not necessary one = Temporal.Duration.from({ minutes: 180 }); two = Temporal.Duration.from({ minutes: 60 }); -one.minus(two); // => PT120M -one.minus(two, { disambiguation: 'balance' }); // => PT2H +one.minus(two); // => PT120M +one.minus(two, { overflow: 'balance' }); // => PT2H // Some balancing necessary, more balancing possible one = Temporal.Duration.from({ minutes: 180 }); two = Temporal.Duration.from({ seconds: 30 }); -one.minus(two); // => PT179M30S -one.minus(two, { disambiguation: 'balance' }); // => PT2H59M30S +one.minus(two); // => PT179M30S +one.minus(two, { overflow: 'balance' }); // => PT2H59M30S // Balancing necessary, result is positive one = Temporal.Duration.from({ hours: 4, minutes: 15 }); two = Temporal.Duration.from({ hours: 2, minutes: 30 }); -one.minus(two); // => PT1H45M -one.minus(two, { disambiguation: 'balance' }); // => PT1H45M +one.minus(two); // => PT1H45M +one.minus(two, { overflow: 'balance' }); // => PT1H45M // Result is negative one = Temporal.Duration.from({ hours: 2, minutes: 30 }); two = Temporal.Duration.from({ hours: 3 }); -one.minus(two); // -PT30M -one.minus(two, { disambiguation: 'balance' }); // -PT30M +one.minus(two); // -PT30M +one.minus(two, { overflow: 'balance' }); // -PT30M // Unbalanceable units, but also no balancing possible one = Temporal.Duration.from({ months: 3, days: 15 }); two = Temporal.Duration.from({ days: 10 }); -one.minus(two); // => P3M5D -one.minus(two, { disambiguation: 'balance' }); // => P3M5D +one.minus(two); // => P3M5D +one.minus(two, { overflow: 'balance' }); // => P3M5D // Result is in theory positive in the ISO calendar, but unbalanceable units one = Temporal.Duration.from({ months: 3, days: 15 }); two = Temporal.Duration.from({ days: 30 }); -one.minus(two); // throws -one.minus(two, { disambiguation: 'balance' }); // throws +one.minus(two); // throws +one.minus(two, { overflow: 'balance' }); // throws ``` ## Serialization diff --git a/docs/calendar.md b/docs/calendar.md index cb0b82f9ff..c4d78a8b38 100644 --- a/docs/calendar.md +++ b/docs/calendar.md @@ -176,7 +176,7 @@ They provide a way to construct other Temporal objects from values in the calend - `fields` (object): An object with properties similar to what is passed to `Temporal.Date.from()`, `Temporal.YearMonth.from()`, or `Temporal.MonthDay.from()`, respectively. - `options`: (object): An object with properties representing options for constructing the Temporal object. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in `fields`. + - `overflow` (string): How to deal with out-of-range values in `fields`. Allowed values are `constrain`, `balance`, and `reject`. The default is `constrain`. - `constructor` (function): The constructor function of the Temporal type to construct. @@ -191,7 +191,7 @@ For example: ```javascript date = Temporal.Date.from( { year: 5780, month: 9, day: 6, calendar: 'hebrew' }, - { disambiguation: 'reject' } + { overflow: 'reject' } ); date.year // => 5780 date.month // => 9 @@ -201,7 +201,7 @@ date.toString() // => 2020-05-29[c=hebrew] // same result, but calling the method directly: date = Temporal.Calendar.from('hebrew').dateFromFields( { year: 5780, month: 9, day: 6 }, - { disambiguation: 'reject' }, + { overflow: 'reject' }, Temporal.Date ); date.year // => 5780 @@ -222,7 +222,7 @@ They provide a way to do date arithmetic in the calendar's date reckoning. - `duration` (`Temporal.Duration`): A duration to add or subtract from `date`. - `options` (object): An object with properties representing options for performing the addition or subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in the result of the addition or subtraction. + - `overflow` (string): How to deal with out-of-range values in the result of the addition or subtraction. Allowed values are `constrain` and `reject`. The default is `constrain`. - `constructor` (function): The constructor function of the Temporal type to construct. @@ -237,7 +237,7 @@ For example: ```javascript date = Temporal.Date.from('2020-05-29').withCalendar('islamic').plus( Temporal.Duration.from({ months: 1 }), - { disambiguation: 'reject' } + { overflow: 'reject' } ); date.year // => 1441 date.month // => 11 @@ -248,7 +248,7 @@ date.toString() // => 2020-06-28[c=islamic] date = Temporal.Calendar.from('islamic').datePlus( Temporal.Date.from('2020-05-29'), Temporal.Duration.from({ months: 1 }), - { disambiguation: 'reject' }, + { overflow: 'reject' }, Temporal.Date ); date.year // => 1441 diff --git a/docs/cookbook.md b/docs/cookbook.md index 3d99c2ca6d..19c7cf66a9 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -410,7 +410,7 @@ Here are some examples of taking an existing date, and adjusting the day of the Likewise, here are some examples of taking an existing date and adjusting the month, but keeping the day and year the same. -Depending on the behaviour you want, you will need to pick the right `disambiguation` option, but the default of `"constrain"` should be correct for most cases. +Depending on the behaviour you want, you will need to pick the right `overflow` option, but the default of `"constrain"` should be correct for most cases. ```javascript {{cookbook/adjustMonth.mjs}} diff --git a/docs/cookbook/adjustMonth.mjs b/docs/cookbook/adjustMonth.mjs index 1b5b9e5c7a..7e19fa3fec 100644 --- a/docs/cookbook/adjustMonth.mjs +++ b/docs/cookbook/adjustMonth.mjs @@ -11,5 +11,5 @@ assert.equal(feb.toString(), '2020-02-29'); // (and throw an exception if the date doesn't exist in April): assert.throws(() => { - date.with({ month: 4 }, { disambiguation: 'reject' }); + date.with({ month: 4 }, { overflow: 'reject' }); }); diff --git a/docs/date.md b/docs/date.md index 7f80d0a03a..e8a55edfc5 100644 --- a/docs/date.md +++ b/docs/date.md @@ -27,7 +27,7 @@ A `Temporal.Date` can be converted into a `Temporal.DateTime` by combining it wi **Returns:** a new `Temporal.Date` object. Use this constructor if you have the correct parameters for the date already as individual number values in the ISO 8601 calendar. -Otherwise, `Temporal.Date.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows disambiguation behaviour, is probably more convenient. +Otherwise, `Temporal.Date.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows controlling the overflow behaviour, is probably more convenient. All values are given as reckoned in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates). Together, `isoYear`, `isoMonth`, and `isoDay` must represent a valid date in that calendar, even if you are passing a different calendar as the `calendar` parameter. @@ -51,7 +51,7 @@ date = new Temporal.Date(2020, 3, 14) // => 2020-03-14 - `thing`: The value representing the desired date. - `options` (optional object): An object with properties representing options for constructing the date. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in `thing`. + - `overflow` (string): How to deal with out-of-range values in `thing`. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -64,13 +64,13 @@ A `Temporal.Date` will be constructed from these properties. Any non-object value is converted to a string, which is expected to be in ISO 8601 format. Any time or time zone part is optional and will be ignored. -If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `disambiguation`. +If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `overflow`. -The `disambiguation` option works as follows: +The `overflow` option works as follows: - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value. - In `reject` mode, the presence of out-of-range values will cause the function to throw a `RangeError`. -Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this function will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this function will throw a `RangeError` regardless of `overflow`. > **NOTE**: The allowed values for the `thing.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -92,14 +92,14 @@ date = Temporal.Date.from({ year: 1427, month; 8, day: 1, calendar }); // => 20 date = Temporal.Date.from({ year: 1427, month: 8, day: 1, calendar: 'islamic' }); // => same as above -// Different disambiguation modes -date = Temporal.Date.from({ year: 2001, month: 13, day: 1 }, { disambiguation: 'constrain' }) +// Different overflow modes +date = Temporal.Date.from({ year: 2001, month: 13, day: 1 }, { overflow: 'constrain' }) // => 2001-12-01 -date = Temporal.Date.from({ year: 2001, month: -1, day: 1 }, { disambiguation: 'constrain' }) +date = Temporal.Date.from({ year: 2001, month: -1, day: 1 }, { overflow: 'constrain' }) // => 2001-01-01 -date = Temporal.Date.from({ year: 2001, month: 13, day: 1 }, { disambiguation: 'reject' }) +date = Temporal.Date.from({ year: 2001, month: 13, day: 1 }, { overflow: 'reject' }) // throws -date = Temporal.Date.from({ year: 2001, month: -1, day: 1 }, { disambiguation: 'reject' }) +date = Temporal.Date.from({ year: 2001, month: -1, day: 1 }, { overflow: 'reject' }) // throws ``` @@ -274,7 +274,7 @@ date.with({year: 2100}).leapYear // => false - `dateLike` (object): an object with some or all of the properties of a `Temporal.Date`. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -284,7 +284,7 @@ This method creates a new `Temporal.Date` which is a copy of `date`, but any pro Since `Temporal.Date` objects are immutable, use this method instead of modifying one. -If the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +If the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. > **NOTE**: The allowed values for the `dateLike.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -327,7 +327,7 @@ date.withCalendar('iso8601') // => 2006-08-24 - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the addition. The following options are recognized: - - `disambiguation` (optional string): How to deal with additions that result in out-of-range values. + - `overflow` (optional string): How to deal with additions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -339,11 +339,11 @@ The `duration` argument is an object with properties denoting a duration, such a Some additions may be ambiguous, because months have different lengths. For example, adding one month to August 31 would result in September 31, which doesn't exist. -For these cases, the `disambiguation` option tells what to do: +For these cases, the `overflow` option tells what to do: - In `constrain` mode (the default), out-of-range values are clamped to the nearest in-range value. - In `reject` mode, an addition that would result in an out-of-range value fails, and a `RangeError` is thrown. -Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. Adding a negative duration is equivalent to subtracting the absolute value of that duration. @@ -354,7 +354,7 @@ date.plus({years: 20, months: 4}) // => 2026-12-24 date = Temporal.Date.from('2019-01-31') date.plus({ months: 1 }) // => 2019-02-28 -date.plus({ months: 1 }, { disambiguation: 'reject' }) // => throws +date.plus({ months: 1 }, { overflow: 'reject' }) // => throws ``` ### date.**minus**(_duration_: object, _options_?: object) : Temporal.Date @@ -363,7 +363,7 @@ date.plus({ months: 1 }, { disambiguation: 'reject' }) // => throws - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with subtractions that result in out-of-range values. + - `overflow` (string): How to deal with subtractions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -375,11 +375,11 @@ The `duration` argument is an object with properties denoting a duration, such a Some subtractions may be ambiguous, because months have different lengths. For example, subtracting one month from July 31 would result in June 31, which doesn't exist. -For these cases, the `disambiguation` option tells what to do: +For these cases, the `overflow` option tells what to do: - In `constrain` mode (the default), out-of-range values are clamped to the nearest in-range value. - In `reject` mode, an addition that would result in an out-of-range value fails, and a `RangeError` is thrown. -Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.Date` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. Subtracting a negative duration is equivalent to adding the absolute value of that duration. @@ -390,7 +390,7 @@ date.minus({years: 20, months: 4}) // => 1986-04-24 date = Temporal.Date.from('2019-03-31') date.minus({ months: 1 }) // => 2019-02-28 -date.minus({ months: 1 }, { disambiguation: 'reject' }) // => throws +date.minus({ months: 1 }, { overflow: 'reject' }) // => throws ``` ### date.**difference**(_other_: Temporal.Date, _options_?: object) : Temporal.Duration diff --git a/docs/datetime.md b/docs/datetime.md index 8290b33928..064ce8eda0 100644 --- a/docs/datetime.md +++ b/docs/datetime.md @@ -38,7 +38,7 @@ A `Temporal.DateTime` can also be converted into any of the other `Temporal` obj **Returns:** a new `Temporal.DateTime` object. Use this constructor if you have the correct parameters for the date already as individual number values in the ISO 8601 calendar. -Otherwise, `Temporal.DateTime.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows disambiguation behaviour, is probably more convenient. +Otherwise, `Temporal.DateTime.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows controlling the overflow behaviour, is probably more convenient. All values are given as reckoned in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates). Together, `isoYear`, `isoMonth`, and `isoDay` must represent a valid date in that calendar, even if you are passing a different calendar as the `calendar` parameter, and the time parameters must represent a valid time of day. @@ -65,7 +65,7 @@ datetime = new Temporal.DateTime(2020, 3, 14, 13, 37) // => 2020-03-14T13:37 - `thing`: The value representing the desired date and time. - `options` (optional object): An object with properties representing options for constructing the date and time. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in `thing`. + - `overflow` (string): How to deal with out-of-range values in `thing`. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -80,16 +80,16 @@ Any other missing ones will be assumed to be 0. Any non-object value is converted to a string, which is expected to be in ISO 8601 format. Any time zone part is optional and will be ignored. -If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `disambiguation`. +If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `overflow`. -The `disambiguation` option works as follows: +The `overflow` option works as follows: - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value. - In `reject` mode, the presence of out-of-range values will cause the function to throw a `RangeError`. -Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. > **NOTE**: Although Temporal does not deal with leap seconds, dates coming from other software may have a `second` value of 60. -> In the default `constrain` disambiguation mode and when parsing an ISO 8601 string, this will be converted to 59. +> In the default `constrain` mode and when parsing an ISO 8601 string, this will be converted to 59. > In `reject` mode, this function will throw, so if you have to interoperate with times that may contain leap seconds, don't use `reject`. > **NOTE**: The allowed values for the `thing.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -123,24 +123,24 @@ dt = Temporal.DateTime.from({ year: 5756, month: 3, day: 14, hour: 3, minute: 24 dt = Temporal.DateTime.from({ year: 5756, month: 3, day: 14, hour: 3, minute: 24, second: 30, calendar: 'hebrew' }); // => same as above -// Different disambiguation modes -dt = Temporal.DateTime.from({ year: 2001, month: 13, day: 1 }, { disambiguation: 'constrain' }) +// Different overflow modes +dt = Temporal.DateTime.from({ year: 2001, month: 13, day: 1 }, { overflow: 'constrain' }) // => 2001-12-01T00:00 -dt = Temporal.DateTime.from({ year: 2001, month: -1, day: 1 }, { disambiguation: 'constrain' }) +dt = Temporal.DateTime.from({ year: 2001, month: -1, day: 1 }, { overflow: 'constrain' }) // => 2001-01-01T00:00 -dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, hour: 25 }, { disambiguation: 'constrain' }) +dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, hour: 25 }, { overflow: 'constrain' }) // => 2001-01-01T23:00 -dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { disambiguation: 'constrain' }) +dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { overflow: 'constrain' }) // => 2001-01-01T00:59 -dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { disambiguation: 'constrain' }) +dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { overflow: 'constrain' }) // => 2001-01-01T01:00 -dt = Temporal.DateTime.from({ year: 2001, month: 13, day: 1 }, { disambiguation: 'reject' }) +dt = Temporal.DateTime.from({ year: 2001, month: 13, day: 1 }, { overflow: 'reject' }) // throws -dt = Temporal.DateTime.from({ year: 2001, month: -1, day: 1 }, { disambiguation: 'reject' }) +dt = Temporal.DateTime.from({ year: 2001, month: -1, day: 1 }, { overflow: 'reject' }) // throws -dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, hour: 25 }, { disambiguation: 'reject' }) +dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, hour: 25 }, { overflow: 'reject' }) // throws -dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { disambiguation: 'reject' }) +dt = Temporal.DateTime.from({ year: 2001, month: 1, day: 1, minute: 60 }, { overflow: 'reject' }) // => throws ``` @@ -334,7 +334,7 @@ dt.with({year: 2100}).isLeapYear // => false - `dateTimeLike` (object): an object with some or all of the properties of a `Temporal.DateTime`. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -344,7 +344,7 @@ This method creates a new `Temporal.DateTime` which is a copy of `datetime`, but Since `Temporal.DateTime` objects are immutable, use this method instead of modifying one. -If the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +If the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. > **NOTE**: The allowed values for the `dateTimeLike.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -391,7 +391,7 @@ dt.withCalendar('iso8601') // => 1995-12-07T03:24:30.000003500 - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the addition. The following options are recognized: - - `disambiguation` (string): How to deal with additions that result in out-of-range values. + - `overflow` (string): How to deal with additions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -403,11 +403,11 @@ The `duration` argument is an object with properties denoting a duration, such a Some additions may be ambiguous, because months have different lengths. For example, adding one month to August 31 would result in September 31, which doesn't exist. -For these cases, the `disambiguation` option tells what to do: +For these cases, the `overflow` option tells what to do: - In `constrain` mode (the default), out-of-range values are clamped to the nearest in-range value. - In `reject` mode, an addition that would result in an out-of-range value fails, and a `RangeError` is thrown. -Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. Adding a negative duration is equivalent to subtracting the absolute value of that duration. @@ -418,7 +418,7 @@ dt.plus({years: 20, months: 4, nanoseconds: 500}) // => 2016-04-07T03:24:30.000 dt = Temporal.DateTime.from('2019-01-31T15:30') dt.plus({ months: 1 }) // => 2019-02-28T15:30 -dt.plus({ months: 1 }, { disambiguation: 'reject' }) // => throws +dt.plus({ months: 1 }, { overflow: 'reject' }) // => throws ``` ### datetime.**minus**(_duration_: object, _options_?: object) : Temporal.DateTime @@ -427,7 +427,7 @@ dt.plus({ months: 1 }, { disambiguation: 'reject' }) // => throws - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with subtractions that result in out-of-range values. + - `overflow` (string): How to deal with subtractions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -439,11 +439,11 @@ The `duration` argument is an object with properties denoting a duration, such a Some subtractions may be ambiguous, because months have different lengths. For example, subtracting one month from July 31 would result in June 31, which doesn't exist. -For these cases, the `disambiguation` option tells what to do: +For these cases, the `overflow` option tells what to do: - In `constrain` mode (the default), out-of-range values are clamped to the nearest in-range value. - In `reject` mode, an addition that would result in an out-of-range value fails, and a `RangeError` is thrown. -Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.DateTime` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. Subtracting a negative duration is equivalent to adding the absolute value of that duration. @@ -453,7 +453,7 @@ dt = new Temporal.DateTime(1995, 12, 7, 3, 24, 30, 0, 3, 500); dt.minus({years: 20, months: 4, nanoseconds: 500}) // => 1975-08-07T03:24:30.000003 dt = Temporal.DateTime.from('2019-03-31T15:30') -dt.minus({ months: 1 }, { disambiguation: 'constrain' }) // => 2019-02-28T15:30 +dt.minus({ months: 1 }, { overflow: 'constrain' }) // => 2019-02-28T15:30 dt.minus({ months: 1 }) // => throws ``` diff --git a/docs/duration.md b/docs/duration.md index dc765d2efb..5800b884b1 100644 --- a/docs/duration.md +++ b/docs/duration.md @@ -57,7 +57,7 @@ Any missing or `undefined` numerical arguments are taken to be zero, and all non Any non-zero arguments must all have the same sign. Use this constructor directly if you have the correct parameters already as numerical values. -Otherwise `Temporal.Duration.from()` is probably more convenient because it accepts more kinds of input and allows disambiguation behaviour. +Otherwise `Temporal.Duration.from()` is probably more convenient because it accepts more kinds of input and allows controlling the overflow behaviour. Usage examples: ```javascript @@ -75,7 +75,7 @@ new Temporal.Duration() // => PT0S - `thing`: A `Duration`-like object or a string from which to create a `Temporal.Duration`. - `options` (optional object): An object with properties representing options for constructing the duration. The following options are recognized: - - `disambiguation` (optional string): How to disambiguate if any of the other arguments are out of range. + - `overflow` (optional string): What to do if any of the other arguments are out of range. Allowed values are `constrain`, `balance`, and `reject`. The default is `constrain`. @@ -88,7 +88,7 @@ Any missing ones will be assumed to be 0. Any non-object value is converted to a string, which is expected to be in ISO 8601 format. -The `disambiguation` option controls how out-of-range values are interpreted: +The `overflow` option controls how out-of-range values are interpreted: - `constrain` (the default): Infinite values are clamped to `Number.MAX_VALUE` or `-Number.MAX_VALUE`. Values higher than the next highest unit (for example, 90 minutes) are left as-is. - `balance`: Infinite values will cause the function to throw a `RangeError`. @@ -97,13 +97,13 @@ The `disambiguation` option controls how out-of-range values are interpreted: - `reject`: Infinite values will cause the function to throw a `RangeError`. Values higher than the next highest unit (for example, 90 minutes) are left as-is. -No matter which disambiguation mode is selected, all non-zero values must have the same sign. +No matter which overflow mode is selected, all non-zero values must have the same sign. If they do not, the function will throw a `RangeError`. > **NOTE:** Years and months can have different lengths. In the default ISO calendar, a year can be 365 or 366 days, and a month can be 28, 29, 30, or 31 days. Therefore, any `Duration` object with nonzero years or months can refer to a different length of time depending on when the start date is. -No conversion is ever performed between years, months, weeks, and days, even in `balance` disambiguation mode, because such conversion would be ambiguous. +No conversion is ever performed between years, months, weeks, and days, even in `balance` mode, because such conversion would be ambiguous. > **NOTE:** This function understands strings where weeks and other units are combined, and strings with a single sign character at the start, which are extensions to the ISO 8601 standard described in ISO 8601-2. > (For example, `P3W1D` is understood to mean three weeks and one day, `-P1Y1M` is a negative duration of one year and one month, and `+P1Y1M` is one year and one month.) @@ -125,9 +125,9 @@ d = Temporal.Duration.from({ hours: 1, minutes: -30 }) // throws // Disambiguation -d = Temporal.Duration.from({ minutes: 120 }, { disambiguation: 'constrain' }) // => PT120M -d = Temporal.Duration.from({ minutes: 120 }, { disambiguation: 'balance' }) // => PT2H -d = Temporal.Duration.from({ minutes: 120 }, { disambiguation: 'reject' }) // => PT120M +d = Temporal.Duration.from({ minutes: 120 }, { overflow: 'constrain' }) // => PT120M +d = Temporal.Duration.from({ minutes: 120 }, { overflow: 'balance' }) // => PT2H +d = Temporal.Duration.from({ minutes: 120 }, { overflow: 'reject' }) // => PT120M ``` ## Properties @@ -181,7 +181,7 @@ The read-only `sign` property has the value –1, 0, or 1, depending on whether - `durationLike` (object): an object with some or all of the properties of a `Temporal.Duration`. - `options` (optional object): An object with properties representing options for the copy. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain`, `balance`, and `reject`. The default is `constrain`. @@ -191,7 +191,7 @@ This method creates a new `Temporal.Duration` which is a copy of `duration`, but Since `Temporal.Duration` objects are immutable, use this method instead of modifying one. -The `disambiguation` option specifies what to do with out-of-range or overly large values. +The `overflow` option specifies what to do with out-of-range or overly large values. All non-zero properties of `durationLike` must have the same sign, and they must additionally have the same sign as the non-zero properties of `duration`, unless they override all of these non-zero properties. If a property of `durationLike` is infinity, then constrain mode will clamp it to `Number.MAX_VALUE`. Reject and balance modes will throw a `RangeError` in that case. @@ -206,7 +206,7 @@ duration = Temporal.Duration.from({ months: 50, days: 50, hours: 50, minutes: 10 let { years, months } = duration; years += Math.floor(months / 12); months %= 12; -duration = duration.with({ years, months }, { disambiguation: 'balance' }); +duration = duration.with({ years, months }, { overflow: 'balance' }); // => P4Y2M52DT3H40M ``` @@ -216,7 +216,7 @@ duration = duration.with({ years, months }, { disambiguation: 'balance' }); - `other` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the addition. The following options are recognized: - - `disambiguation` (string): How to deal with additions that result in out-of-range values. + - `overflow` (string): How to deal with additions that result in out-of-range values. Allowed values are `constrain`, `balance`, and `reject`. The default is `constrain`. @@ -229,7 +229,7 @@ The `other` argument is an object with properties denoting a duration, such as ` In order to be valid, the resulting duration must not have fields with mixed signs. However, before the result is balanced, it's possible that the intermediate result will have one or more negative fields while the overall duration is positive, or vice versa. For example, "4 hours and 15 minutes" minus "2 hours and 30 minutes" results in "2 hours and −15 minutes". -The `disambiguation` argument tells what to do in this case, or in the case where the addition results in an out-of-range value: +The `overflow` option tells what to do in this case, or in the case where the addition results in an out-of-range value: - In `constrain` mode (the default), additions that result in a value too large to be represented in a Number are capped at `Number.MAX_VALUE`, or `-Number.MAX_VALUE` if out of range in the other direction. Additions resulting in mixed-sign fields will balance those fields with the next-highest field so that all the fields of the result have the same sign. - In `balance` mode, if any addition results in a value too large to be represented in a Number, a `RangeError` is thrown. @@ -237,9 +237,6 @@ The `disambiguation` argument tells what to do in this case, or in the case wher - In `reject` mode, if any addition results in a value too large to be represented in a Number, a `RangeError` is thrown. Otherwise this is the same as `constrain`. -The fields of the resulting duration are never converted between each other. -If you need this behaviour, use `Duration.from()` with balance disambiguation, which will convert overly large units into the next highest unit, up to days. - For usage examples and a more complete explanation of how balancing works and why it is necessary, see [Duration balancing](./balancing.md). No conversion is ever performed between years, months, days, and other units, as that could be ambiguous depending on the start date. @@ -256,19 +253,17 @@ hour.plus({ minutes: 30 }) // => PT1H30M one = Temporal.Duration.from({ hours: 1, minutes: 30 }); two = Temporal.Duration.from({ hours: 2, minutes: 45 }); result = one.plus(two) // => PT3H75M -result.with(result, { disambiguation: 'balance' }) // => PT4H15M +result.with(result, { overflow: 'balance' }) // => PT4H15M fifty = Temporal.Duration.from('P50Y50M50DT50H50M50.500500500S'); result = fifty.plus(fifty) // => P100Y100M100DT100H100M101.001001S' -// Temporal.Duration.from(result, { disambiguation: 'balance' }); - FIXME: https://github.com/tc39/proposal-temporal/issues/232 -result.with(result, { disambiguation: 'balance' }) +Temporal.Duration.from(result, { overflow: 'balance' }) // => P100Y100M104DT5H41M41.001001S // Example of not balancing: oneAndAHalfYear = Temporal.Duration.from({ years: 1, months: 6 }); result = oneAndAHalfYear.plus(oneAndAHalfYear) // => P2Y12M -// Temporal.Duration.from(result, { disambiguation: 'balance' }); - FIXME: https://github.com/tc39/proposal-temporal/issues/232 -result.with(result, { disambiguation: 'balance' }) // => P2Y12M +Temporal.Duration.from(result, { overflow: 'balance' }) // => P2Y12M // Example of custom conversion using ISO calendar rules: function monthsToYears(duration) { let { years, months } = duration; @@ -286,9 +281,9 @@ monthsToYears(result) // => P3Y - `other` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with subtractions that result in out-of-range values. - Allowed values are `balanceConstrain` and `balance`. - The default is `balanceConstrain`. + - `overflow` (string): How to deal with subtractions that result in out-of-range values. + Allowed values are `constrain`, `balance`, and `reject`. + The default is `constrain`. **Returns:** a new `Temporal.Duration` object which represents the duration of `duration` less the duration of `other`. @@ -301,7 +296,7 @@ If `other` is larger than `duration` and the subtraction would result in a negat In order to be valid, the resulting duration must not have fields with mixed signs. However, before the result is balanced, it's possible that the intermediate result will have one or more negative fields while the overall duration is positive, or vice versa. For example, "4 hours and 15 minutes" minus "2 hours and 30 minutes" results in "2 hours and −15 minutes". -The `disambiguation` argument tells what to do in this case: +The `overflow` argument tells what to do in this case: - In `constrain` mode (the default), subtractions that result in a value too large to be represented in a Number are capped at `Number.MAX_VALUE`, or `-Number.MAX_VALUE` if out of range in the other direction. Subtractions resulting in mixed-sign fields will balance those fields with the next-highest field so that all the fields of the result have the same sign. - In `balance` mode, if any subtraction results in a value too large to be represented in a Number, a `RangeError` is thrown. @@ -321,7 +316,7 @@ hourAndAHalf.minus({ hours: 1 }) // => PT30M one = Temporal.Duration.from({ minutes: 180 }); two = Temporal.Duration.from({ seconds: 30 }); one.minus(two); // => PT179M30S -one.minus(two, { disambiguation: 'balance' }); // => PT2H59M30S +one.minus(two, { overflow: 'balance' }); // => PT2H59M30S // Example of not balancing: threeYears = Temporal.Duration.from({ years: 3 }); @@ -402,7 +397,7 @@ d.toString(); // => PT1S // underlying Temporal.Duration object doesn't. nobal = Temporal.Duration.from({ milliseconds: 3500 }); console.log(`${nobal}`, nobal.seconds, nobal.milliseconds); // => PT3.500S 0 3500 -bal = Temporal.Duration.from({ milliseconds: 3500 }, { disambiguation: 'balance'}); +bal = Temporal.Duration.from({ milliseconds: 3500 }, { overflow: 'balance'}); console.log(`${bal}`, bal.seconds, bal.milliseconds); // => PT3.500S 3 500 ``` diff --git a/docs/monthday.md b/docs/monthday.md index b88457c758..f18023605d 100644 --- a/docs/monthday.md +++ b/docs/monthday.md @@ -26,7 +26,7 @@ A `Temporal.MonthDay` can be converted into a `Temporal.Date` by combining it wi **Returns:** a new `Temporal.MonthDay` object. Use this constructor if you have the correct parameters for the date already as individual number values, or you are implementing a custom calendar. -Otherwise, `Temporal.MonthDay.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows disambiguation behaviour, is probably more convenient. +Otherwise, `Temporal.MonthDay.from()`, which accepts more kinds of input, allows inputting dates in different calendar reckonings, and allows controlling the overflow behaviour, is probably more convenient. All values are given as reckoned in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates). Together, `refISOYear`, `isoMonth` and `isoDay` must represent a valid date in that calendar. @@ -50,7 +50,7 @@ md = new Temporal.MonthDay(2, 29) // => 02-29 - `thing`: The value representing the desired date. - `options` (optional object): An object with properties representing options for constructing the date. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in `thing`. + - `overflow` (string): How to deal with out-of-range values in `thing`. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -62,9 +62,9 @@ If the value is any other object, it must have `month` and `day` properties, and Any non-object value will be converted to a string, which is expected to be in ISO 8601 format. Any parts of the string other than the month and the day are optional and will be ignored. -If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `disambiguation`. +If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `overflow`. -The `disambiguation` option works as follows: +The `overflow` option works as follows: - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value. - In `reject` mode, the presence of out-of-range values will cause the function to throw a `RangeError`. @@ -84,14 +84,14 @@ md = Temporal.MonthDay.from({month: 8, day: 24}); // => 08-24 md = Temporal.MonthDay.from(Temporal.Date.from('2006-08-24')); // => same as above; Temporal.Date has month and day properties -// Different disambiguation modes -md = Temporal.MonthDay.from({ month: 13, day: 1 }, { disambiguation: 'constrain' }) +// Different overflow modes +md = Temporal.MonthDay.from({ month: 13, day: 1 }, { overflow: 'constrain' }) // => 12-01 -md = Temporal.MonthDay.from({ month: -1, day: 1 }, { disambiguation: 'constrain' }) +md = Temporal.MonthDay.from({ month: -1, day: 1 }, { overflow: 'constrain' }) // => 01-01 -md = Temporal.MonthDay.from({ month: 13, day: 1 }, { disambiguation: 'reject' }) +md = Temporal.MonthDay.from({ month: 13, day: 1 }, { overflow: 'reject' }) // throws -md = Temporal.MonthDay.from({ month: -1, day: 1 }, { disambiguation: 'reject' }) +md = Temporal.MonthDay.from({ month: -1, day: 1 }, { overflow: 'reject' }) // throws ``` @@ -124,7 +124,7 @@ The `calendar` read-only property gives the calendar that the `month` and `day` - `monthDayLike` (object): an object with some or all of the properties of a `Temporal.MonthDay`. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -132,7 +132,7 @@ The `calendar` read-only property gives the calendar that the `month` and `day` This method creates a new `Temporal.MonthDay` which is a copy of `monthDay`, but any properties present on `monthDayLike` override the ones already present on `monthDay`. -The disambiguation parameter tells what should happen when out-of-range values are given or when the result would be an invalid month-day combination, such as "June 31": +The `overflow` option tells what should happen when out-of-range values are given or when the result would be an invalid month-day combination, such as "June 31": - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value, so June 31 would become June 30. - In `reject` mode, the presence of out-of-range values will cause the constructor to throw a `RangeError`. @@ -255,7 +255,7 @@ Instead, use `monthDay.equals()` to check for equality. - `year` (number | object): A year, which must have a day corresponding to `monthDay`. Additionally, an object with a `'year'` property is also accepted. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -273,7 +273,7 @@ md.toDateInYear({ year: 2017 }) // equivalent to above md = Temporal.MonthDay.from('02-29'); md.toDateInYear(2020) // => 2020-02-29 md.toDateInYear(2017) // => 2017-02-28 -md.toDateInYear(2017, { disambiguation: 'reject' }) // throws +md.toDateInYear(2017, { overflow: 'reject' }) // throws ``` In calendars where more information than just the year is needed to convert a `Temporal.MonthDay` to a `Temporal.Date`, you can pass an object to `toDateInYear()` that contains the necessary properties. diff --git a/docs/time.md b/docs/time.md index ec2cc1cefb..c28bbd857f 100644 --- a/docs/time.md +++ b/docs/time.md @@ -27,7 +27,7 @@ A `Temporal.Time` can be converted into a `Temporal.DateTime` by combining it wi **Returns:** a new `Temporal.Time` object. Use this constructor if you have the correct parameters for the time already as individual number values. -Otherwise, `Temporal.Time.from()`, which accepts more kinds of input and allows disambiguation behaviour, is probably more convenient. +Otherwise, `Temporal.Time.from()`, which accepts more kinds of input and allows controlling the overflow behaviour, is probably more convenient. Usage examples: ```javascript @@ -43,7 +43,7 @@ time = new Temporal.Time(13, 37) // => 13:37 - `thing`: The value representing the desired time. - `options` (optional object): An object with properties representing options for constructing the time. The following options are recognized: - - `disambiguation` (optional string): How to deal with out-of-range values of the other parameters. + - `overflow` (optional string): How to deal with out-of-range values of the other parameters. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -57,12 +57,12 @@ Any missing ones will be assumed to be 0. Any non-object value will be converted to a string, which is expected to be in ISO 8601 format. If the string designates a date or a time zone, they will be ignored. -The `disambiguation` option works as follows: +The `overflow` option works as follows: - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value. - In `reject` mode, the presence of out-of-range values will cause the function to throw a `RangeError`. > **NOTE**: Although Temporal does not deal with leap seconds, times coming from other software may have a `second` value of 60. -> In the default `constrain` disambiguation mode, this will be converted to 59. +> In the default `constrain` mode, this will be converted to 59. > In `reject` mode, the constructor will throw, so if you have to interoperate with times that may contain leap seconds, don't use `reject`. > However, if parsing an ISO 8601 string with a seconds component of `:60`, then it will always result in a `second` value of 59, in accordance with POSIX. @@ -87,14 +87,14 @@ time = Temporal.Time.from({ hour: 19, minute: 39, second: 9 }); // => 19:39:09 time = Temporal.Time.from(Temporal.DateTime.from('2020-02-15T19:39:09')); // => same as above; Temporal.DateTime has hour, minute, etc. properties -// Different disambiguation modes -time = Temporal.Time.from({ hour: 15, minute: 60 }, { disambiguation: 'constrain' }); +// Different overflow modes +time = Temporal.Time.from({ hour: 15, minute: 60 }, { overflow: 'constrain' }); // => 15:59 -time = Temporal.Time.from({ hour: 15, minute: -1 }, { disambiguation: 'constrain' }); +time = Temporal.Time.from({ hour: 15, minute: -1 }, { overflow: 'constrain' }); // => 15:00 -time = Temporal.Time.from({ hour: 15, minute: 60 }, { disambiguation: 'reject' }); +time = Temporal.Time.from({ hour: 15, minute: 60 }, { overflow: 'reject' }); // throws -time = Temporal.Time.from({ hour: 15, minute: -1 }, { disambiguation: 'reject' }); +time = Temporal.Time.from({ hour: 15, minute: -1 }, { overflow: 'reject' }); // throws ``` @@ -157,7 +157,7 @@ time.nanosecond // => 205 - `timeLike` (object): an object with some or all of the properties of a `Temporal.Time`. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -186,7 +186,7 @@ time.plus({hours: 1}).with({ - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the addition. The following options are recognized: - - `disambiguation` (string): How to deal with additions that result in out-of-range values. + - `overflow` (string): How to deal with additions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -197,7 +197,7 @@ Due to times wrapping around when reaching 24 hours, the returned point in time The `duration` argument is an object with properties denoting a duration, such as `{ hours: 5, minutes: 30 }`, or a `Temporal.Duration` object. -The `disambiguation` parameter has no effect in the default ISO calendar, because the units of hours, minutes, and seconds are always the same length and therefore not ambiguous. +The `overflow` parameter has no effect in the default ISO calendar, because the units of hours, minutes, and seconds are always the same length and therefore not ambiguous. However, it may have an effect in other calendars where those units are not always the same length. Adding a negative duration is equivalent to subtracting the absolute value of that duration. @@ -214,7 +214,7 @@ time.plus({ minutes: 5, nanoseconds: 800 }) // => 19:44:09.068347005 - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with subtractions that result in out-of-range values. + - `overflow` (string): How to deal with subtractions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -225,7 +225,7 @@ Due to times wrapping around when reaching 24 hours, the returned point in time The `duration` argument is an object with properties denoting a duration, such as `{ hours: 5, minutes: 30 }`, or a `Temporal.Duration` object. -The `disambiguation` parameter has no effect in the default ISO calendar, because the units of hours, minutes, and seconds are always the same length and therefore not ambiguous. +The `overflow` parameter has no effect in the default ISO calendar, because the units of hours, minutes, and seconds are always the same length and therefore not ambiguous. However, it may have an effect in other calendars where those units are not always the same length. Subtracting a negative duration is equivalent to adding the absolute value of that duration. diff --git a/docs/yearmonth.md b/docs/yearmonth.md index 476fe51391..73e2cd26d1 100644 --- a/docs/yearmonth.md +++ b/docs/yearmonth.md @@ -25,7 +25,7 @@ A `Temporal.YearMonth` can be converted into a `Temporal.Date` by combining it w **Returns:** a new `Temporal.YearMonth` object. Use this constructor if you have the correct parameters already as individual number values in the ISO 8601 calendar, or you are implementing a custom calendar. -Otherwise, `Temporal.YearMonth.from()`, which accepts more kinds of input, allows months in other calendar systems, and allows disambiguation behaviour, is probably more convenient. +Otherwise, `Temporal.YearMonth.from()`, which accepts more kinds of input, allows months in other calendar systems, and allows controlling the overflow behaviour, is probably more convenient. All values are given as reckoned in the [ISO 8601 calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates). Together, `isoYear`, `isoMonth`, and `refISODay` must represent a valid date in that calendar, even if you are passing a different calendar as the `calendar` parameter. @@ -49,7 +49,7 @@ ym = new Temporal.YearMonth(2019, 6) // => 2019-06 - `thing`: The value representing the desired month. - `options` (optional object): An object with properties representing options for constructing the date. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values in `thing`. + - `overflow` (string): How to deal with out-of-range values in `thing`. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -61,13 +61,13 @@ If the value is any other object, it must have `year` and `month` properties, an Any non-object value is converted to a string, which is expected to be in ISO 8601 format. Any parts of the string other than the year and the month are optional and will be ignored. -If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `disambiguation`. +If the string isn't valid according to ISO 8601, then a `RangeError` will be thrown regardless of the value of `overflow`. -The `disambiguation` option works as follows: +The `overflow` option works as follows: - In `constrain` mode (the default), any out-of-range values are clamped to the nearest in-range value. - In `reject` mode, the presence of out-of-range values will cause the function to throw a `RangeError`. -Additionally, if the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +Additionally, if the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. > **NOTE**: The allowed values for the `thing.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -85,14 +85,14 @@ ym = Temporal.YearMonth.from({year: 2019, month: 6}); // => 2019-06 ym = Temporal.YearMonth.from(Temporal.Date.from('2019-06-24')); // => same as above; Temporal.Date has year and month properties -// Different disambiguation modes -ym = Temporal.YearMonth.from({ year: 2001, month: 13 }, { disambiguation: 'constrain' }) +// Different overflow modes +ym = Temporal.YearMonth.from({ year: 2001, month: 13 }, { overflow: 'constrain' }) // => 2001-12 -ym = Temporal.YearMonth.from({ year: 2001, month: -1 }, { disambiguation: 'constrain' }) +ym = Temporal.YearMonth.from({ year: 2001, month: -1 }, { overflow: 'constrain' }) // => 2001-01 -ym = Temporal.YearMonth.from({ year: 2001, month: 13 }, { disambiguation: 'reject' }) +ym = Temporal.YearMonth.from({ year: 2001, month: 13 }, { overflow: 'reject' }) // throws -ym = Temporal.YearMonth.from({ year: 2001, month: -1 }, { disambiguation: 'reject' }) +ym = Temporal.YearMonth.from({ year: 2001, month: -1 }, { overflow: 'reject' }) // throws ``` @@ -215,7 +215,7 @@ ym.with({year: 2100}).isLeapYear // => false - `yearMonthLike` (object): an object with some or all of the properties of a `Temporal.YearMonth`. - `options` (optional object): An object with properties representing options for the operation. The following options are recognized: - - `disambiguation` (string): How to deal with out-of-range values. + - `overflow` (string): How to deal with out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -225,7 +225,7 @@ This method creates a new `Temporal.YearMonth` which is a copy of `yearMonth`, b Since `Temporal.YearMonth` objects are immutable, use this method instead of modifying one. -If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. > **NOTE**: The allowed values for the `yearMonthLike.month` property start at 1, which is different from legacy `Date` where months are represented by zero-based indices (0 to 11). @@ -246,7 +246,7 @@ ym.with({month: 12}) // => 2019-12 - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the addition. The following options are recognized: - - `disambiguation` (string): How to deal with additions that result in out-of-range values. + - `overflow` (string): How to deal with additions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -256,11 +256,11 @@ This method adds `duration` to `yearMonth`, returning a month that is in the fut The `duration` argument is an object with properties denoting a duration, such as `{ months: 5 }`, or a `Temporal.Duration` object. -If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. -Other than for out-of-range values, the `disambiguation` option has no effect in the default ISO calendar, because a year is always 12 months and therefore not ambiguous. +The `overflow` option has no effect in the default ISO calendar, because a year is always 12 months and therefore not ambiguous. It doesn't matter in this case that years and months can be different numbers of days, as the resolution of `Temporal.YearMonth` does not distinguish days. -However, disambiguation may have an effect in other calendars where years can be different numbers of months. +However, `overflow` may have an effect in other calendars where years can be different numbers of months. Adding a negative duration is equivalent to subtracting the absolute value of that duration. @@ -276,7 +276,7 @@ ym.plus({years: 20, months: 4}) // => 2039-10 - `duration` (object): A `Temporal.Duration` object or a duration-like object. - `options` (optional object): An object with properties representing options for the subtraction. The following options are recognized: - - `disambiguation` (string): How to deal with additions that result in out-of-range values. + - `overflow` (string): How to deal with additions that result in out-of-range values. Allowed values are `constrain` and `reject`. The default is `constrain`. @@ -286,11 +286,11 @@ This method subtracts `duration` from `yearMonth`, returning a month that is in The `duration` argument is an object with properties denoting a duration, such as `{ months: 5 }`, or a `Temporal.Duration` object. -If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `disambiguation`. +If the result is earlier or later than the range of dates that `Temporal.YearMonth` can represent (approximately half a million years centered on the [Unix epoch](https://en.wikipedia.org/wiki/Unix_time)), then this method will throw a `RangeError` regardless of `overflow`. -Other than for out-of-range values, the `disambiguation` option has no effect in the default ISO calendar, because a year is always 12 months and therefore not ambiguous. +The `overflow` option has no effect in the default ISO calendar, because a year is always 12 months and therefore not ambiguous. It doesn't matter in this case that years and months can be different numbers of days, as the resolution of `Temporal.YearMonth` does not distinguish days. -However, disambiguation may have an effect in other calendars where years can be different numbers of months. +However, `overflow` may have an effect in other calendars where years can be different numbers of months. Subtracting a negative duration is equivalent to adding the absolute value of that duration. diff --git a/polyfill/index.d.ts b/polyfill/index.d.ts index c43cde1afa..8aeb796bab 100644 --- a/polyfill/index.d.ts +++ b/polyfill/index.d.ts @@ -17,7 +17,7 @@ export namespace Temporal { * * The default is `'constrain'`. */ - disambiguation: 'constrain' | 'reject'; + overflow: 'constrain' | 'reject'; }; /** @@ -38,7 +38,7 @@ export namespace Temporal { * * The default is `'constrain'`. */ - disambiguation: 'constrain' | 'balance' | 'reject'; + overflow: 'constrain' | 'balance' | 'reject'; }; /** @@ -83,7 +83,7 @@ export namespace Temporal { * * The default is `'constrain'`. */ - disambiguation: 'constrain' | 'reject'; + overflow: 'constrain' | 'reject'; }; export interface DifferenceOptions { diff --git a/polyfill/lib/calendar.mjs b/polyfill/lib/calendar.mjs index 66fe706794..4b85abe2ef 100644 --- a/polyfill/lib/calendar.mjs +++ b/polyfill/lib/calendar.mjs @@ -129,31 +129,31 @@ class ISO8601Calendar extends Calendar { } dateFromFields(fields, options, constructor) { if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); // Intentionally alphabetical let { year, month, day } = ES.ToTemporalDateRecord(fields); - ({ year, month, day } = ES.RegulateDate(year, month, day, disambiguation)); + ({ year, month, day } = ES.RegulateDate(year, month, day, overflow)); return new constructor(year, month, day, this); } yearMonthFromFields(fields, options, constructor) { if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); // Intentionally alphabetical let { year, month } = ES.ToTemporalYearMonthRecord(fields); - ({ year, month } = ES.RegulateYearMonth(year, month, disambiguation)); + ({ year, month } = ES.RegulateYearMonth(year, month, overflow)); return new constructor(year, month, this, /* refIsoDay = */ 1); } monthDayFromFields(fields, options, constructor) { if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); // Intentionally alphabetical let { month, day } = ES.ToTemporalMonthDayRecord(fields); - ({ month, day } = ES.RegulateMonthDay(month, day, disambiguation)); + ({ month, day } = ES.RegulateMonthDay(month, day, overflow)); return new constructor(month, day, this, /* refIsoYear = */ 1972); } datePlus(date, duration, options, constructor) { if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const { years, months, weeks, days } = duration; ES.RejectDurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); const sign = ES.DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); @@ -161,15 +161,15 @@ class ISO8601Calendar extends Calendar { let month = GetSlot(date, ISO_MONTH); let day = GetSlot(date, ISO_DAY); if (sign < 0) { - ({ year, month, day } = ES.SubtractDate(year, month, day, -years, -months, -weeks, -days, disambiguation)); + ({ year, month, day } = ES.SubtractDate(year, month, day, -years, -months, -weeks, -days, overflow)); } else { - ({ year, month, day } = ES.AddDate(year, month, day, years, months, weeks, days, disambiguation)); + ({ year, month, day } = ES.AddDate(year, month, day, years, months, weeks, days, overflow)); } return new constructor(year, month, day, this); } dateMinus(date, duration, options, constructor) { if (!ES.IsTemporalCalendar(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const { years, months, weeks, days } = duration; ES.RejectDurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); const sign = ES.DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0); @@ -177,9 +177,9 @@ class ISO8601Calendar extends Calendar { let month = GetSlot(date, ISO_MONTH); let day = GetSlot(date, ISO_DAY); if (sign < 0) { - ({ year, month, day } = ES.AddDate(year, month, day, -years, -months, -weeks, -days, disambiguation)); + ({ year, month, day } = ES.AddDate(year, month, day, -years, -months, -weeks, -days, overflow)); } else { - ({ year, month, day } = ES.SubtractDate(year, month, day, years, months, weeks, days, disambiguation)); + ({ year, month, day } = ES.SubtractDate(year, month, day, years, months, weeks, days, overflow)); } return new constructor(year, month, day, this); } diff --git a/polyfill/lib/date.mjs b/polyfill/lib/date.mjs index 17ac541e2a..6a07cf9197 100644 --- a/polyfill/lib/date.mjs +++ b/polyfill/lib/date.mjs @@ -240,7 +240,7 @@ export class Date { }; } static from(item, options = undefined) { - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%'); let result; if (typeof item === 'object' && item) { @@ -258,7 +258,7 @@ export class Date { } } else { let { year, month, day, calendar } = ES.ParseTemporalDateString(ES.ToString(item)); - ({ year, month, day } = ES.RegulateDate(year, month, day, disambiguation)); + ({ year, month, day } = ES.RegulateDate(year, month, day, overflow)); if (!calendar) calendar = GetDefaultCalendar(); calendar = TemporalCalendar.from(calendar); result = new this(year, month, day, calendar); diff --git a/polyfill/lib/datetime.mjs b/polyfill/lib/datetime.mjs index 6086e3bb57..01a5b102e7 100644 --- a/polyfill/lib/datetime.mjs +++ b/polyfill/lib/datetime.mjs @@ -148,7 +148,7 @@ export class DateTime { } with(temporalDateTimeLike, options) { if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); let source; let calendar = temporalDateTimeLike.calendar; if (calendar) { @@ -199,7 +199,7 @@ export class DateTime { millisecond, microsecond, nanosecond, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, DateTime); const result = new Construct( @@ -472,7 +472,7 @@ export class DateTime { toAbsolute(temporalTimeZoneLike, options) { if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver'); const timeZone = ES.ToTemporalTimeZone(temporalTimeZoneLike); - const disambiguation = ES.ToTimeZoneTemporalDisambiguation(options); + const disambiguation = ES.ToTemporalDisambiguation(options); return ES.GetTemporalAbsoluteFor(timeZone, this, disambiguation); } toDate() { @@ -520,7 +520,7 @@ export class DateTime { } static from(item, options = undefined) { - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%'); let result; if (typeof item === 'object' && item) { @@ -547,11 +547,11 @@ export class DateTime { let month = GetSlot(date, ISO_MONTH); let day = GetSlot(date, ISO_DAY); - if (disambiguation === 'constrain') { + if (overflow === 'constrain') { // Special case to determine if the date was clipped by dateFromFields // and therefore the time possibly needs to be clipped too try { - calendar.dateFromFields(fields, { disambiguation: 'reject' }, TemporalDate); + calendar.dateFromFields(fields, { overflow: 'reject' }, TemporalDate); } catch { // Date was clipped if (year === 275760 && month === 9 && day === 13) { @@ -573,7 +573,7 @@ export class DateTime { millisecond, microsecond, nanosecond, - disambiguation + overflow )); result = new this(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar); } diff --git a/polyfill/lib/duration.mjs b/polyfill/lib/duration.mjs index be58a1a515..f28ff8ab3a 100644 --- a/polyfill/lib/duration.mjs +++ b/polyfill/lib/duration.mjs @@ -138,7 +138,7 @@ export class Duration { } with(durationLike, options) { if (!ES.IsTemporalDuration(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToDurationTemporalDisambiguation(options); + const overflow = ES.ToTemporalDurationOverflow(options); const props = ES.ToPartialRecord(durationLike, [ 'days', 'hours', @@ -188,7 +188,7 @@ export class Duration { milliseconds, microseconds, nanoseconds, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Duration); const result = new Construct( @@ -257,7 +257,7 @@ export class Duration { nanoseconds } = ES.ToLimitedTemporalDuration(other); ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); - const disambiguation = ES.ToDurationTemporalDisambiguation(options); + const overflow = ES.ToTemporalDurationOverflow(options); ({ years, months, @@ -290,7 +290,7 @@ export class Duration { milliseconds, microseconds, nanoseconds, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Duration); const result = new Construct( @@ -323,7 +323,7 @@ export class Duration { nanoseconds } = ES.ToLimitedTemporalDuration(other); ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); - const disambiguation = ES.ToDurationTemporalDisambiguation(options); + const overflow = ES.ToTemporalDurationOverflow(options); ({ years, months, @@ -356,7 +356,7 @@ export class Duration { -milliseconds, -microseconds, -nanoseconds, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Duration); const result = new Construct( @@ -406,7 +406,7 @@ export class Duration { throw new TypeError('not possible to compare Temporal.Duration'); } static from(item, options = undefined) { - const disambiguation = ES.ToDurationTemporalDisambiguation(options); + const overflow = ES.ToTemporalDurationOverflow(options); let years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds; if (typeof item === 'object' && item) { ({ @@ -457,7 +457,7 @@ export class Duration { milliseconds, microseconds, nanoseconds, - disambiguation + overflow )); const result = new this( years, diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs index 1727621fb4..9f371f4f09 100644 --- a/polyfill/lib/ecmascript.mjs +++ b/polyfill/lib/ecmascript.mjs @@ -256,8 +256,8 @@ export const ES = ObjectAssign({}, ES2019, { } throw new RangeError(`'${isoString}' doesn't uniquely identify a Temporal.Absolute`); }, - RegulateDateTime: (year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, disambiguation) => { - switch (disambiguation) { + RegulateDateTime: (year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, overflow) => { + switch (overflow) { case 'reject': ES.RejectDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond); break; @@ -277,8 +277,8 @@ export const ES = ObjectAssign({}, ES2019, { } return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond }; }, - RegulateDate: (year, month, day, disambiguation) => { - switch (disambiguation) { + RegulateDate: (year, month, day, overflow) => { + switch (overflow) { case 'reject': ES.RejectDate(year, month, day); break; @@ -288,8 +288,8 @@ export const ES = ObjectAssign({}, ES2019, { } return { year, month, day }; }, - RegulateTime: (hour, minute, second, millisecond, microsecond, nanosecond, disambiguation) => { - switch (disambiguation) { + RegulateTime: (hour, minute, second, millisecond, microsecond, nanosecond, overflow) => { + switch (overflow) { case 'reject': ES.RejectTime(hour, minute, second, millisecond, microsecond, nanosecond); break; @@ -306,9 +306,9 @@ export const ES = ObjectAssign({}, ES2019, { } return { hour, minute, second, millisecond, microsecond, nanosecond }; }, - RegulateYearMonth: (year, month, disambiguation) => { + RegulateYearMonth: (year, month, overflow) => { const refISODay = 1; - switch (disambiguation) { + switch (overflow) { case 'reject': ES.RejectDate(year, month, refISODay); break; @@ -318,9 +318,9 @@ export const ES = ObjectAssign({}, ES2019, { } return { year, month }; }, - RegulateMonthDay: (month, day, disambiguation) => { + RegulateMonthDay: (month, day, overflow) => { const refISOYear = 1972; - switch (disambiguation) { + switch (overflow) { case 'reject': ES.RejectDate(refISOYear, month, day); break; @@ -369,10 +369,10 @@ export const ES = ObjectAssign({}, ES2019, { milliseconds, microseconds, nanoseconds, - disambiguation + overflow ) => { ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); - switch (disambiguation) { + switch (overflow) { case 'reject': for (const prop of [ years, @@ -464,15 +464,15 @@ export const ES = ObjectAssign({}, ES2019, { } return duration; }, - ToDurationTemporalDisambiguation: (options) => { + ToTemporalDurationOverflow: (options) => { options = ES.NormalizeOptionsObject(options); - return ES.GetOption(options, 'disambiguation', ['constrain', 'balance', 'reject'], 'constrain'); + return ES.GetOption(options, 'overflow', ['constrain', 'balance', 'reject'], 'constrain'); }, - ToTemporalDisambiguation: (options) => { + ToTemporalOverflow: (options) => { options = ES.NormalizeOptionsObject(options); - return ES.GetOption(options, 'disambiguation', ['constrain', 'reject'], 'constrain'); + return ES.GetOption(options, 'overflow', ['constrain', 'reject'], 'constrain'); }, - ToTimeZoneTemporalDisambiguation: (options) => { + ToTemporalDisambiguation: (options) => { options = ES.NormalizeOptionsObject(options); return ES.GetOption(options, 'disambiguation', ['compatible', 'earlier', 'later', 'reject'], 'compatible'); }, @@ -1383,11 +1383,11 @@ export const ES = ObjectAssign({}, ES2019, { return { deltaDays, hours, minutes, seconds, milliseconds, microseconds, nanoseconds }; }, - AddDate: (year, month, day, years, months, weeks, days, disambiguation) => { + AddDate: (year, month, day, years, months, weeks, days, overflow) => { year += years; month += months; ({ year, month } = ES.BalanceYearMonth(year, month)); - ({ year, month, day } = ES.RegulateDate(year, month, day, disambiguation)); + ({ year, month, day } = ES.RegulateDate(year, month, day, overflow)); days += 7 * weeks; day += days; ({ year, month, day } = ES.BalanceDate(year, month, day)); @@ -1424,14 +1424,14 @@ export const ES = ObjectAssign({}, ES2019, { )); return { deltaDays, hour, minute, second, millisecond, microsecond, nanosecond }; }, - SubtractDate: (year, month, day, years, months, weeks, days, disambiguation) => { + SubtractDate: (year, month, day, years, months, weeks, days, overflow) => { days += 7 * weeks; day -= days; ({ year, month, day } = ES.BalanceDate(year, month, day)); month -= months; year -= years; ({ year, month } = ES.BalanceYearMonth(year, month)); - ({ year, month, day } = ES.RegulateDate(year, month, day, disambiguation)); + ({ year, month, day } = ES.RegulateDate(year, month, day, overflow)); return { year, month, day }; }, SubtractTime: ( @@ -1486,7 +1486,7 @@ export const ES = ObjectAssign({}, ES2019, { ms2, µs2, ns2, - disambiguation + overflow ) => { let years = y1 + y2; let months = mon1 + mon2; @@ -1573,7 +1573,7 @@ export const ES = ObjectAssign({}, ES2019, { milliseconds, microseconds, nanoseconds, - disambiguation + overflow ); }, diff --git a/polyfill/lib/monthday.mjs b/polyfill/lib/monthday.mjs index 35f513bd01..e26ccf1fea 100644 --- a/polyfill/lib/monthday.mjs +++ b/polyfill/lib/monthday.mjs @@ -120,7 +120,7 @@ export class MonthDay { }; } static from(item, options = undefined) { - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%'); let result; if (typeof item === 'object' && item) { @@ -138,7 +138,7 @@ export class MonthDay { } } else { let { month, day, refISOYear, calendar } = ES.ParseTemporalMonthDayString(ES.ToString(item)); - ({ month, day } = ES.RegulateMonthDay(month, day, disambiguation)); + ({ month, day } = ES.RegulateMonthDay(month, day, overflow)); if (!calendar) calendar = GetDefaultCalendar(); calendar = TemporalCalendar.from(calendar); if (refISOYear === undefined) refISOYear = 1972; diff --git a/polyfill/lib/time.mjs b/polyfill/lib/time.mjs index a5658d1baf..6d146432f6 100644 --- a/polyfill/lib/time.mjs +++ b/polyfill/lib/time.mjs @@ -74,7 +74,7 @@ export class Time { with(temporalTimeLike = {}, options) { if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver'); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const props = ES.ToPartialRecord(temporalTimeLike, [ 'hour', 'microsecond', @@ -101,7 +101,7 @@ export class Time { millisecond, microsecond, nanosecond, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Time); const result = new Construct(hour, minute, second, millisecond, microsecond, nanosecond); @@ -112,7 +112,7 @@ export class Time { if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver'); let { hour, minute, second, millisecond, microsecond, nanosecond } = this; const duration = ES.ToLimitedTemporalDuration(temporalDurationLike); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration; ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); const sign = ES.DurationSign( @@ -165,7 +165,7 @@ export class Time { millisecond, microsecond, nanosecond, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Time); const result = new Construct(hour, minute, second, millisecond, microsecond, nanosecond); @@ -176,7 +176,7 @@ export class Time { if (!ES.IsTemporalTime(this)) throw new TypeError('invalid receiver'); let { hour, minute, second, millisecond, microsecond, nanosecond } = this; const duration = ES.ToLimitedTemporalDuration(temporalDurationLike); - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration; ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); const sign = ES.DurationSign( @@ -229,7 +229,7 @@ export class Time { millisecond, microsecond, nanosecond, - disambiguation + overflow )); const Construct = ES.SpeciesConstructor(this, Time); const result = new Construct(hour, minute, second, millisecond, microsecond, nanosecond); @@ -309,7 +309,7 @@ export class Time { } static from(item, options = undefined) { - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); let hour, minute, second, millisecond, microsecond, nanosecond; if (typeof item === 'object' && item) { if (ES.IsTemporalTime(item)) { @@ -333,7 +333,7 @@ export class Time { millisecond, microsecond, nanosecond, - disambiguation + overflow )); const result = new this(hour, minute, second, millisecond, microsecond, nanosecond); if (!ES.IsTemporalTime(result)) throw new TypeError('invalid result'); diff --git a/polyfill/lib/timezone.mjs b/polyfill/lib/timezone.mjs index 7af913f068..f883cf6094 100644 --- a/polyfill/lib/timezone.mjs +++ b/polyfill/lib/timezone.mjs @@ -90,7 +90,7 @@ export class TimeZone { } getAbsoluteFor(dateTime, options) { if (!ES.IsTemporalDateTime(dateTime)) throw new TypeError('invalid DateTime object'); - const disambiguation = ES.ToTimeZoneTemporalDisambiguation(options); + const disambiguation = ES.ToTemporalDisambiguation(options); const Absolute = GetIntrinsic('%Temporal.Absolute%'); const possibleAbsolutes = this.getPossibleAbsolutesFor(dateTime); diff --git a/polyfill/lib/yearmonth.mjs b/polyfill/lib/yearmonth.mjs index 697de8e6c0..99261d8394 100644 --- a/polyfill/lib/yearmonth.mjs +++ b/polyfill/lib/yearmonth.mjs @@ -181,7 +181,7 @@ export class YearMonth { const calendar = GetSlot(this, CALENDAR); const fields = ES.ToTemporalYearMonthRecord(this); const Date = GetIntrinsic('%Temporal.Date%'); - return calendar.dateFromFields({ ...fields, day }, { disambiguation: 'reject' }, Date); + return calendar.dateFromFields({ ...fields, day }, { overflow: 'reject' }, Date); } getFields() { const fields = ES.ToTemporalYearMonthRecord(this); @@ -199,7 +199,7 @@ export class YearMonth { }; } static from(item, options = undefined) { - const disambiguation = ES.ToTemporalDisambiguation(options); + const overflow = ES.ToTemporalOverflow(options); const TemporalCalendar = GetIntrinsic('%Temporal.Calendar%'); let result; if (typeof item === 'object' && item) { @@ -217,7 +217,7 @@ export class YearMonth { } } else { let { year, month, refISODay, calendar } = ES.ParseTemporalYearMonthString(ES.ToString(item)); - ({ year, month } = ES.RegulateYearMonth(year, month, disambiguation)); + ({ year, month } = ES.RegulateYearMonth(year, month, overflow)); if (!calendar) calendar = GetDefaultCalendar(); calendar = TemporalCalendar.from(calendar); if (refISODay === undefined) refISODay = 1; diff --git a/polyfill/test/Date/constructor/from/infinity-handled.js b/polyfill/test/Date/constructor/from/infinity-handled.js index 6e318b76ba..fc7dd1a79c 100644 --- a/polyfill/test/Date/constructor/from/infinity-handled.js +++ b/polyfill/test/Date/constructor/from/infinity-handled.js @@ -8,21 +8,21 @@ esid: sec-temporal.date.from // constrain -assert.throws(RangeError, () => Temporal.Date.from({ year: Infinity, month: 1, day: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.Date.from({ year: 1970, month: Infinity, day: 1 }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.Date.from({ year: Infinity, month: 1, day: 1 }, { overflow: 'constrain' })); +let result = Temporal.Date.from({ year: 1970, month: Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 12); assert.sameValue(result.day, 1); -result = Temporal.Date.from({ year: 1970, month: 1, day: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: 1, day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 31); // reject -assert.throws(RangeError, () => Temporal.Date.from({ year: Infinity, month: 1, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: Infinity, month: 1, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -32,16 +32,16 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Date.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/constructor/from/negative-infinity-handled.js b/polyfill/test/Date/constructor/from/negative-infinity-handled.js index 3d5580d487..a8b0ec31f0 100644 --- a/polyfill/test/Date/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/Date/constructor/from/negative-infinity-handled.js @@ -8,21 +8,21 @@ esid: sec-temporal.date.from // constrain -assert.throws(RangeError, () => Temporal.Date.from({ year: -Infinity, month: 1, day: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.Date.from({ year: 1970, month: -Infinity, day: 1 }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.Date.from({ year: -Infinity, month: 1, day: 1 }, { overflow: 'constrain' })); +let result = Temporal.Date.from({ year: 1970, month: -Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); -result = Temporal.Date.from({ year: 1970, month: 1, day: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: 1, day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); // reject -assert.throws(RangeError, () => Temporal.Date.from({ year: -Infinity, month: 1, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: -Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: -Infinity, month: 1, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: -Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -32,16 +32,16 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Date.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.Date.from({ year: 1970, month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: obj, month: 1, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Date.from({ year: 1970, month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/constructor/from/subclass-invalid-arg.js b/polyfill/test/Date/constructor/from/subclass-invalid-arg.js index a709054515..e7e23e702a 100644 --- a/polyfill/test/Date/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/Date/constructor/from/subclass-invalid-arg.js @@ -14,5 +14,5 @@ class MyDate extends Temporal.Date { } } -assert.throws(RangeError, () => MyDate.from({ year: 2020, month: 13, day: 1 }, { disambiguation: "reject" })); +assert.throws(RangeError, () => MyDate.from({ year: 2020, month: 13, day: 1 }, { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/Date/prototype/minus/infinity-throws-rangeerror.js b/polyfill/test/Date/prototype/minus/infinity-throws-rangeerror.js index 229de5127d..55c1dc3848 100644 --- a/polyfill/test/Date/prototype/minus/infinity-throws-rangeerror.js +++ b/polyfill/test/Date/prototype/minus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Date.from({ year: 2000, month: 5, day: 2 }); // constrain -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/prototype/minus/negative-infinity-throws-rangeerror.js b/polyfill/test/Date/prototype/minus/negative-infinity-throws-rangeerror.js index e18dbb978d..425d07693f 100644 --- a/polyfill/test/Date/prototype/minus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Date/prototype/minus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Date.from({ year: 2000, month: 5, day: 2 }); // constrain -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/prototype/plus/infinity-throws-rangeerror.js b/polyfill/test/Date/prototype/plus/infinity-throws-rangeerror.js index 450e8dc484..9ec01c6643 100644 --- a/polyfill/test/Date/prototype/plus/infinity-throws-rangeerror.js +++ b/polyfill/test/Date/prototype/plus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Date.from({ year: 2000, month: 5, day: 2 }); // constrain -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/prototype/plus/negative-infinity-throws-rangeerror.js b/polyfill/test/Date/prototype/plus/negative-infinity-throws-rangeerror.js index 1b95a34040..b0a53050d8 100644 --- a/polyfill/test/Date/prototype/plus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Date/prototype/plus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Date.from({ year: 2000, month: 5, day: 2 }); // constrain -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/prototype/with/infinity-handled.js b/polyfill/test/Date/prototype/with/infinity-handled.js index 4e67865469..dc738e16c3 100644 --- a/polyfill/test/Date/prototype/with/infinity-handled.js +++ b/polyfill/test/Date/prototype/with/infinity-handled.js @@ -10,21 +10,21 @@ const instance = new Temporal.Date(2000, 5, 2); // constrain -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 12); assert.sameValue(result.day, 2); -result = instance.with({ day: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 31); // reject -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -34,16 +34,16 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Date/prototype/with/negative-infinity-handled.js b/polyfill/test/Date/prototype/with/negative-infinity-handled.js index b9c2c391dd..bde25896a4 100644 --- a/polyfill/test/Date/prototype/with/negative-infinity-handled.js +++ b/polyfill/test/Date/prototype/with/negative-infinity-handled.js @@ -10,21 +10,21 @@ const instance = new Temporal.Date(2000, 5, 2); // constrain -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: -Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 1); assert.sameValue(result.day, 2); -result = instance.with({ day: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 1); // reject -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -34,16 +34,16 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/constructor/from/infinity-handled.js b/polyfill/test/DateTime/constructor/from/infinity-handled.js index fad2bfbc6f..9cd4b487fe 100644 --- a/polyfill/test/DateTime/constructor/from/infinity-handled.js +++ b/polyfill/test/DateTime/constructor/from/infinity-handled.js @@ -8,8 +8,8 @@ esid: sec-temporal.datetime.from // constrain -assert.throws(RangeError, () => Temporal.DateTime.from({ year: Infinity, month: 1, day: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.DateTime.from({ year: 1970, month: Infinity, day: 1 }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: Infinity, month: 1, day: 1 }, { overflow: 'constrain' })); +let result = Temporal.DateTime.from({ year: 1970, month: Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 12); assert.sameValue(result.day, 1); @@ -19,7 +19,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 31); @@ -29,7 +29,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -39,7 +39,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -49,7 +49,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -59,7 +59,7 @@ assert.sameValue(result.second, 59); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -69,7 +69,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 999); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -79,7 +79,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 999); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -92,15 +92,15 @@ assert.sameValue(result.nanosecond, 999); // reject -assert.throws(RangeError, () => Temporal.DateTime.from({ year: Infinity, month: 1, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: Infinity, month: 1, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -110,40 +110,40 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/constructor/from/negative-infinity-handled.js b/polyfill/test/DateTime/constructor/from/negative-infinity-handled.js index 44b614b609..50972330e3 100644 --- a/polyfill/test/DateTime/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/DateTime/constructor/from/negative-infinity-handled.js @@ -8,8 +8,8 @@ esid: sec-temporal.datetime.from // constrain -assert.throws(RangeError, () => Temporal.DateTime.from({ year: -Infinity, month: 1, day: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.DateTime.from({ year: 1970, month: -Infinity, day: 1 }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: -Infinity, month: 1, day: 1 }, { overflow: 'constrain' })); +let result = Temporal.DateTime.from({ year: 1970, month: -Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -19,7 +19,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -29,7 +29,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -39,7 +39,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -49,7 +49,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -59,7 +59,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -69,7 +69,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -79,7 +79,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); @@ -92,15 +92,15 @@ assert.sameValue(result.nanosecond, 0); // reject -assert.throws(RangeError, () => Temporal.DateTime.from({ year: -Infinity, month: 1, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: -Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: -Infinity, month: 1, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: -Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -110,40 +110,40 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: obj, month: 1, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.DateTime.from({ year: 1970, month: 1, day: 1, nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/constructor/from/subclass-invalid-arg.js b/polyfill/test/DateTime/constructor/from/subclass-invalid-arg.js index 9aded844e9..fbf59ed076 100644 --- a/polyfill/test/DateTime/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/DateTime/constructor/from/subclass-invalid-arg.js @@ -14,5 +14,5 @@ class MyDateTime extends Temporal.DateTime { } } -assert.throws(RangeError, () => MyDateTime.from({ year: 2020, month: 13, day: 1 }, { disambiguation: "reject" })); +assert.throws(RangeError, () => MyDateTime.from({ year: 2020, month: 13, day: 1 }, { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/DateTime/prototype/minus/infinity-throws-rangeerror.js b/polyfill/test/DateTime/prototype/minus/infinity-throws-rangeerror.js index d841dbdaee..9796e5cb0b 100644 --- a/polyfill/test/DateTime/prototype/minus/infinity-throws-rangeerror.js +++ b/polyfill/test/DateTime/prototype/minus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.DateTime.from({ year: 2000, month: 5, day: 2, minute: // constrain -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/prototype/minus/negative-infinity-throws-rangeerror.js b/polyfill/test/DateTime/prototype/minus/negative-infinity-throws-rangeerror.js index a0424bddb7..a2db68bb6e 100644 --- a/polyfill/test/DateTime/prototype/minus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/DateTime/prototype/minus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.DateTime.from({ year: 2000, month: 5, day: 2, minute: // constrain -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/prototype/plus/infinity-throws-rangeerror.js b/polyfill/test/DateTime/prototype/plus/infinity-throws-rangeerror.js index 0ec39c0466..27eb27d3d2 100644 --- a/polyfill/test/DateTime/prototype/plus/infinity-throws-rangeerror.js +++ b/polyfill/test/DateTime/prototype/plus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.DateTime.from({ year: 2000, month: 5, day: 2, minute: // constrain -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/prototype/plus/negative-infinity-throws-rangeerror.js b/polyfill/test/DateTime/prototype/plus/negative-infinity-throws-rangeerror.js index df21f8c8ae..9f7f5bca16 100644 --- a/polyfill/test/DateTime/prototype/plus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/DateTime/prototype/plus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.DateTime.from({ year: 2000, month: 5, day: 2, minute: // constrain -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/prototype/with/infinity-handled.js b/polyfill/test/DateTime/prototype/with/infinity-handled.js index db46949625..94a66479fd 100644 --- a/polyfill/test/DateTime/prototype/with/infinity-handled.js +++ b/polyfill/test/DateTime/prototype/with/infinity-handled.js @@ -10,8 +10,8 @@ const instance = new Temporal.DateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 12); assert.sameValue(result.day, 2); @@ -21,7 +21,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ day: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 31); @@ -31,7 +31,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ hour: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ hour: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -41,7 +41,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ minute: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ minute: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -51,7 +51,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ second: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ second: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -61,7 +61,7 @@ assert.sameValue(result.second, 59); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ millisecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -71,7 +71,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 999); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ microsecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -81,7 +81,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 999); assert.sameValue(result.nanosecond, 321); -result = instance.with({ nanosecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -94,15 +94,15 @@ assert.sameValue(result.nanosecond, 999); // reject -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ hour: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minute: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ second: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ millisecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microsecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanosecond: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -112,40 +112,40 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = instance.with({ hour: obj }, { disambiguation: 'constrain' }); +result = instance.with({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = instance.with({ minute: obj }, { disambiguation: 'constrain' }); +result = instance.with({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = instance.with({ second: obj }, { disambiguation: 'constrain' }); +result = instance.with({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = instance.with({ millisecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = instance.with({ microsecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = instance.with({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); diff --git a/polyfill/test/DateTime/prototype/with/negative-infinity-handled.js b/polyfill/test/DateTime/prototype/with/negative-infinity-handled.js index 5d3417eec7..590cddc1ec 100644 --- a/polyfill/test/DateTime/prototype/with/negative-infinity-handled.js +++ b/polyfill/test/DateTime/prototype/with/negative-infinity-handled.js @@ -10,8 +10,8 @@ const instance = new Temporal.DateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: -Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 1); assert.sameValue(result.day, 2); @@ -21,7 +21,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ day: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 1); @@ -31,7 +31,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ hour: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ hour: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -41,7 +41,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ minute: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ minute: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -51,7 +51,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ second: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ second: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -61,7 +61,7 @@ assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ millisecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -71,7 +71,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ microsecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -81,7 +81,7 @@ assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 321); -result = instance.with({ nanosecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 5); assert.sameValue(result.day, 2); @@ -94,15 +94,15 @@ assert.sameValue(result.nanosecond, 0); // reject -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ hour: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minute: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ second: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ millisecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microsecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanosecond: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -112,40 +112,40 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = instance.with({ hour: obj }, { disambiguation: 'constrain' }); +result = instance.with({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = instance.with({ minute: obj }, { disambiguation: 'constrain' }); +result = instance.with({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = instance.with({ second: obj }, { disambiguation: 'constrain' }); +result = instance.with({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = instance.with({ millisecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = instance.with({ microsecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = instance.with({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/constructor/from/argument-existing-object.js b/polyfill/test/Duration/constructor/from/argument-existing-object.js index e7d2fe67e8..c15c2c2ef5 100644 --- a/polyfill/test/Duration/constructor/from/argument-existing-object.js +++ b/polyfill/test/Duration/constructor/from/argument-existing-object.js @@ -9,7 +9,7 @@ const unbalanced = Temporal.Duration.from({ milliseconds: 1000 }); assert.sameValue(unbalanced.seconds, 0); assert.sameValue(unbalanced.milliseconds, 1000); -const balanced = Temporal.Duration.from(unbalanced, { disambiguation: "balance" }); +const balanced = Temporal.Duration.from(unbalanced, { overflow: "balance" }); assert.notSameValue(balanced, unbalanced); assert.sameValue(unbalanced.seconds, 0); assert.sameValue(unbalanced.milliseconds, 1000); diff --git a/polyfill/test/Duration/constructor/from/infinity-handled.js b/polyfill/test/Duration/constructor/from/infinity-handled.js index e074ec1c5d..fbc8755af1 100644 --- a/polyfill/test/Duration/constructor/from/infinity-handled.js +++ b/polyfill/test/Duration/constructor/from/infinity-handled.js @@ -8,7 +8,7 @@ esid: sec-temporal.duration.from // constrain -let result = Temporal.Duration.from({ years: Infinity }, { disambiguation: 'constrain' }); +let result = Temporal.Duration.from({ years: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, Number.MAX_VALUE); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -19,7 +19,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ months: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ months: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, Number.MAX_VALUE); assert.sameValue(result.weeks, 0); @@ -30,7 +30,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ weeks: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ weeks: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, Number.MAX_VALUE); @@ -41,7 +41,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ days: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ days: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -52,7 +52,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ hours: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ hours: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -63,7 +63,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ minutes: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ minutes: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -74,7 +74,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ seconds: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ seconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -85,7 +85,7 @@ assert.sameValue(result.seconds, Number.MAX_VALUE); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ milliseconds: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ milliseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -96,7 +96,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, Number.MAX_VALUE); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ microseconds: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ microseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -107,7 +107,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, Number.MAX_VALUE); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ nanoseconds: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ nanoseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -121,29 +121,29 @@ assert.sameValue(result.nanoseconds, Number.MAX_VALUE); // balance -assert.throws(RangeError, () => Temporal.Duration.from({ years: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ months: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ days: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => Temporal.Duration.from({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -153,65 +153,65 @@ const obj = { } }; -result = Temporal.Duration.from({ years: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ years: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.Duration.from({ months: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ months: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Duration.from({ weeks: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ weeks: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.Duration.from({ days: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ days: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.Duration.from({ hours: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ hours: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.Duration.from({ minutes: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ minutes: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = Temporal.Duration.from({ seconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ seconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ milliseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ microseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -result = Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 10, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/constructor/from/negative-infinity-handled.js b/polyfill/test/Duration/constructor/from/negative-infinity-handled.js index 0103b3b66c..f4bc18968f 100644 --- a/polyfill/test/Duration/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/Duration/constructor/from/negative-infinity-handled.js @@ -8,7 +8,7 @@ esid: sec-temporal.duration.from // constrain -let result = Temporal.Duration.from({ years: -Infinity }, { disambiguation: 'constrain' }); +let result = Temporal.Duration.from({ years: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, -Number.MAX_VALUE); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -19,7 +19,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ months: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ months: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, -Number.MAX_VALUE); assert.sameValue(result.weeks, 0); @@ -30,7 +30,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ weeks: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ weeks: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, -Number.MAX_VALUE); @@ -41,7 +41,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ days: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ days: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -52,7 +52,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ hours: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ hours: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -63,7 +63,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ minutes: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ minutes: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -74,7 +74,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ seconds: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ seconds: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -85,7 +85,7 @@ assert.sameValue(result.seconds, -Number.MAX_VALUE); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ milliseconds: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ milliseconds: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -96,7 +96,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, -Number.MAX_VALUE); assert.sameValue(result.microseconds, 0); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ microseconds: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ microseconds: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -107,7 +107,7 @@ assert.sameValue(result.seconds, 0); assert.sameValue(result.milliseconds, 0); assert.sameValue(result.microseconds, -Number.MAX_VALUE); assert.sameValue(result.nanoseconds, 0); -result = Temporal.Duration.from({ nanoseconds: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ nanoseconds: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 0); assert.sameValue(result.months, 0); assert.sameValue(result.weeks, 0); @@ -121,29 +121,29 @@ assert.sameValue(result.nanoseconds, -Number.MAX_VALUE); // balance -assert.throws(RangeError, () => Temporal.Duration.from({ years: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ months: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ days: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: -Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: -Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => Temporal.Duration.from({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -153,65 +153,65 @@ const obj = { } }; -result = Temporal.Duration.from({ years: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ years: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.Duration.from({ months: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ months: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Duration.from({ weeks: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ weeks: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.Duration.from({ days: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ days: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.Duration.from({ hours: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ hours: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.Duration.from({ minutes: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ minutes: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = Temporal.Duration.from({ seconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ seconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ milliseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ microseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -result = Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'constrain' }); +result = Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 10, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Duration.from({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/constructor/from/subclass-invalid-arg.js b/polyfill/test/Duration/constructor/from/subclass-invalid-arg.js index 44ea600bad..76f7d48208 100644 --- a/polyfill/test/Duration/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/Duration/constructor/from/subclass-invalid-arg.js @@ -14,6 +14,6 @@ class MyDuration extends Temporal.Duration { } } -assert.throws(RangeError, () => MyDuration.from({ years: Infinity }, { disambiguation: "reject" })); -assert.throws(RangeError, () => MyDuration.from({ days: -Infinity }, { disambiguation: "reject" })); +assert.throws(RangeError, () => MyDuration.from({ years: Infinity }, { overflow: "reject" })); +assert.throws(RangeError, () => MyDuration.from({ days: -Infinity }, { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/Duration/prototype/minus/infinity-throws-rangeerror.js b/polyfill/test/Duration/prototype/minus/infinity-throws-rangeerror.js index e63b7fe871..197e3ca7aa 100644 --- a/polyfill/test/Duration/prototype/minus/infinity-throws-rangeerror.js +++ b/polyfill/test/Duration/prototype/minus/infinity-throws-rangeerror.js @@ -10,42 +10,42 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // balance -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -55,65 +55,65 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/minus/negative-infinity-throws-rangeerror.js b/polyfill/test/Duration/prototype/minus/negative-infinity-throws-rangeerror.js index 656b6d26ab..6551ad4206 100644 --- a/polyfill/test/Duration/prototype/minus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Duration/prototype/minus/negative-infinity-throws-rangeerror.js @@ -10,42 +10,42 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // balance -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -55,65 +55,65 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/minus/subclass-out-of-range.js b/polyfill/test/Duration/prototype/minus/subclass-out-of-range.js index 4ead32d962..d61f7e67f5 100644 --- a/polyfill/test/Duration/prototype/minus/subclass-out-of-range.js +++ b/polyfill/test/Duration/prototype/minus/subclass-out-of-range.js @@ -32,5 +32,5 @@ assert.sameValue(result.microseconds, 0, "microseconds result"); assert.sameValue(result.nanoseconds, -Number.MAX_VALUE, "nanoseconds result"); assert.sameValue(called, 2); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Number.MAX_VALUE }, { disambiguation: "reject" })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Number.MAX_VALUE }, { overflow: "reject" })); assert.sameValue(called, 2); diff --git a/polyfill/test/Duration/prototype/plus/infinity-throws-rangeerror.js b/polyfill/test/Duration/prototype/plus/infinity-throws-rangeerror.js index 7d7c6744a5..fb21f12e26 100644 --- a/polyfill/test/Duration/prototype/plus/infinity-throws-rangeerror.js +++ b/polyfill/test/Duration/prototype/plus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/plus/negative-infinity-throws-rangeerror.js b/polyfill/test/Duration/prototype/plus/negative-infinity-throws-rangeerror.js index 606e13e8a4..5b107e9b98 100644 --- a/polyfill/test/Duration/prototype/plus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Duration/prototype/plus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/plus/subclass-out-of-range.js b/polyfill/test/Duration/prototype/plus/subclass-out-of-range.js index ab700de486..0b134493ed 100644 --- a/polyfill/test/Duration/prototype/plus/subclass-out-of-range.js +++ b/polyfill/test/Duration/prototype/plus/subclass-out-of-range.js @@ -32,5 +32,5 @@ assert.sameValue(result.microseconds, 0, "microseconds result"); assert.sameValue(result.nanoseconds, Number.MAX_VALUE, "nanoseconds result"); assert.sameValue(called, 2); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Number.MAX_VALUE }, { disambiguation: "reject" })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Number.MAX_VALUE }, { overflow: "reject" })); assert.sameValue(called, 2); diff --git a/polyfill/test/Duration/prototype/with/infinity-handled.js b/polyfill/test/Duration/prototype/with/infinity-handled.js index 5d2e4be2e0..ac7755f976 100644 --- a/polyfill/test/Duration/prototype/with/infinity-handled.js +++ b/polyfill/test/Duration/prototype/with/infinity-handled.js @@ -10,7 +10,7 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -let result = instance.with({ years: Infinity }, { disambiguation: 'constrain' }); +let result = instance.with({ years: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, Number.MAX_VALUE); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -21,7 +21,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ months: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ months: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, Number.MAX_VALUE); assert.sameValue(result.weeks, 3); @@ -32,7 +32,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ weeks: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ weeks: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, Number.MAX_VALUE); @@ -43,7 +43,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ days: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ days: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -54,7 +54,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ hours: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ hours: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -65,7 +65,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ minutes: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ minutes: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -76,7 +76,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ seconds: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ seconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -87,7 +87,7 @@ assert.sameValue(result.seconds, Number.MAX_VALUE); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ milliseconds: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ milliseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -98,7 +98,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, Number.MAX_VALUE); assert.sameValue(result.microseconds, 654); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ microseconds: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ microseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -109,7 +109,7 @@ assert.sameValue(result.seconds, 7); assert.sameValue(result.milliseconds, 987); assert.sameValue(result.microseconds, Number.MAX_VALUE); assert.sameValue(result.nanoseconds, 321); -result = instance.with({ nanoseconds: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ nanoseconds: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.years, 1); assert.sameValue(result.months, 2); assert.sameValue(result.weeks, 3); @@ -123,29 +123,29 @@ assert.sameValue(result.nanoseconds, Number.MAX_VALUE); // balance -assert.throws(RangeError, () => instance.with({ years: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ months: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ weeks: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ days: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ hours: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ minutes: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ seconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ milliseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ microseconds: Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ nanoseconds: Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ years: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ months: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ weeks: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ days: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ hours: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ minutes: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ seconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ milliseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ microseconds: Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => instance.with({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -155,65 +155,65 @@ const obj = { } }; -result = instance.with({ years: obj }, { disambiguation: 'constrain' }); +result = instance.with({ years: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = instance.with({ months: obj }, { disambiguation: 'constrain' }); +result = instance.with({ months: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ weeks: obj }, { disambiguation: 'constrain' }); +result = instance.with({ weeks: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = instance.with({ days: obj }, { disambiguation: 'constrain' }); +result = instance.with({ days: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = instance.with({ hours: obj }, { disambiguation: 'constrain' }); +result = instance.with({ hours: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = instance.with({ minutes: obj }, { disambiguation: 'constrain' }); +result = instance.with({ minutes: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -result = instance.with({ seconds: obj }, { disambiguation: 'constrain' }); +result = instance.with({ seconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 7, "it fetches the primitive value"); -result = instance.with({ milliseconds: obj }, { disambiguation: 'constrain' }); +result = instance.with({ milliseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 8, "it fetches the primitive value"); -result = instance.with({ microseconds: obj }, { disambiguation: 'constrain' }); +result = instance.with({ microseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 9, "it fetches the primitive value"); -result = instance.with({ nanoseconds: obj }, { disambiguation: 'constrain' }); +result = instance.with({ nanoseconds: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 10, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/with/negative-infinity-throws-rangeerror.js b/polyfill/test/Duration/prototype/with/negative-infinity-throws-rangeerror.js index ca75af16a9..6c9080185e 100644 --- a/polyfill/test/Duration/prototype/with/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Duration/prototype/with/negative-infinity-throws-rangeerror.js @@ -10,42 +10,42 @@ const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321); // constrain -assert.throws(RangeError, () => instance.with({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // balance -assert.throws(RangeError, () => instance.with({ years: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ months: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ days: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { disambiguation: 'balance' })); -assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ years: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ months: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ days: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { overflow: 'balance' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { overflow: 'balance' })); // reject -assert.throws(RangeError, () => instance.with({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -55,65 +55,65 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ years: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ years: obj }, { overflow: 'balance' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ months: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ months: obj }, { overflow: 'balance' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ weeks: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ weeks: obj }, { overflow: 'balance' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ days: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ days: obj }, { overflow: 'balance' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hours: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ hours: obj }, { overflow: 'balance' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minutes: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ minutes: obj }, { overflow: 'balance' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ seconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ seconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ microseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { disambiguation: 'balance' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { overflow: 'balance' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 21, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 22, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 23, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 24, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 25, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 26, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 27, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 28, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 29, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 30, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Duration/prototype/with/subclass-out-of-range.js b/polyfill/test/Duration/prototype/with/subclass-out-of-range.js index 65c469d1b5..243759db3f 100644 --- a/polyfill/test/Duration/prototype/with/subclass-out-of-range.js +++ b/polyfill/test/Duration/prototype/with/subclass-out-of-range.js @@ -37,6 +37,6 @@ assert.sameValue(result.microseconds, 0, "microseconds result"); assert.sameValue(result.nanoseconds, 0, "nanoseconds result"); assert.sameValue(called, 2); -assert.throws(RangeError, () => instance.with({ days: Infinity }, { disambiguation: "balance" })); -assert.throws(RangeError, () => instance.with({ days: Infinity }, { disambiguation: "reject" })); +assert.throws(RangeError, () => instance.with({ days: Infinity }, { overflow: "balance" })); +assert.throws(RangeError, () => instance.with({ days: Infinity }, { overflow: "reject" })); assert.sameValue(called, 2); diff --git a/polyfill/test/MonthDay/constructor/from/infinity-handled.js b/polyfill/test/MonthDay/constructor/from/infinity-handled.js index 035690187a..c1b5fffe04 100644 --- a/polyfill/test/MonthDay/constructor/from/infinity-handled.js +++ b/polyfill/test/MonthDay/constructor/from/infinity-handled.js @@ -8,17 +8,17 @@ esid: sec-temporal.monthday.from // constrain -let result = Temporal.MonthDay.from({ month: Infinity, day: 1 }, { disambiguation: 'constrain' }); +let result = Temporal.MonthDay.from({ month: Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.month, 12); assert.sameValue(result.day, 1); -result = Temporal.MonthDay.from({ month: 1, day: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: 1, day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 1); assert.sameValue(result.day, 31); // reject -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -28,12 +28,12 @@ const obj = { } }; -result = Temporal.MonthDay.from({ month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.MonthDay.from({ month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/MonthDay/constructor/from/negative-infinity-handled.js b/polyfill/test/MonthDay/constructor/from/negative-infinity-handled.js index 41dc5c917b..6acfc32f80 100644 --- a/polyfill/test/MonthDay/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/MonthDay/constructor/from/negative-infinity-handled.js @@ -8,17 +8,17 @@ esid: sec-temporal.monthday.from // constrain -let result = Temporal.MonthDay.from({ month: -Infinity, day: 1 }, { disambiguation: 'constrain' }); +let result = Temporal.MonthDay.from({ month: -Infinity, day: 1 }, { overflow: 'constrain' }); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); -result = Temporal.MonthDay.from({ month: 1, day: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: 1, day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 1); assert.sameValue(result.day, 1); // reject -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: -Infinity, day: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: -Infinity, day: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -28,12 +28,12 @@ const obj = { } }; -result = Temporal.MonthDay.from({ month: obj, day: 1 }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: obj, day: 1 }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.MonthDay.from({ month: 1, day: obj }, { disambiguation: 'constrain' }); +result = Temporal.MonthDay.from({ month: 1, day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: obj, day: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: obj, day: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.MonthDay.from({ month: 1, day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/MonthDay/constructor/from/subclass-invalid-arg.js b/polyfill/test/MonthDay/constructor/from/subclass-invalid-arg.js index fb84e72cef..f2213c117d 100644 --- a/polyfill/test/MonthDay/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/MonthDay/constructor/from/subclass-invalid-arg.js @@ -14,7 +14,7 @@ class MyMonthDay extends Temporal.MonthDay { } } -assert.throws(RangeError, () => MyMonthDay.from("00-01", { disambiguation: "reject" })); -assert.throws(RangeError, () => MyMonthDay.from("02-30", { disambiguation: "reject" })); -assert.throws(RangeError, () => MyMonthDay.from("13-24", { disambiguation: "reject" })); +assert.throws(RangeError, () => MyMonthDay.from("00-01", { overflow: "reject" })); +assert.throws(RangeError, () => MyMonthDay.from("02-30", { overflow: "reject" })); +assert.throws(RangeError, () => MyMonthDay.from("13-24", { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/MonthDay/prototype/with/infinity-handled.js b/polyfill/test/MonthDay/prototype/with/infinity-handled.js index 9417b824b5..5f9c6c226e 100644 --- a/polyfill/test/MonthDay/prototype/with/infinity-handled.js +++ b/polyfill/test/MonthDay/prototype/with/infinity-handled.js @@ -10,17 +10,17 @@ const instance = new Temporal.MonthDay(5, 2); // constrain -let result = instance.with({ month: Infinity }, { disambiguation: 'constrain' }); +let result = instance.with({ month: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 12); assert.sameValue(result.day, 2); -result = instance.with({ day: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 5); assert.sameValue(result.day, 31); // reject -assert.throws(RangeError, () => instance.with({ month: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -30,12 +30,12 @@ const obj = { } }; -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/MonthDay/prototype/with/negative-infinity-handled.js b/polyfill/test/MonthDay/prototype/with/negative-infinity-handled.js index 780e7ec84e..753b457101 100644 --- a/polyfill/test/MonthDay/prototype/with/negative-infinity-handled.js +++ b/polyfill/test/MonthDay/prototype/with/negative-infinity-handled.js @@ -10,17 +10,17 @@ const instance = new Temporal.MonthDay(5, 2); // constrain -let result = instance.with({ month: -Infinity }, { disambiguation: 'constrain' }); +let result = instance.with({ month: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 1); assert.sameValue(result.day, 2); -result = instance.with({ day: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ day: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.month, 5); assert.sameValue(result.day, 1); // reject -assert.throws(RangeError, () => instance.with({ month: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ day: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -30,12 +30,12 @@ const obj = { } }; -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = instance.with({ day: obj }, { disambiguation: 'constrain' }); +result = instance.with({ day: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ day: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ day: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/MonthDay/prototype/with/subclass-out-of-range.js b/polyfill/test/MonthDay/prototype/with/subclass-out-of-range.js index bda389547f..44730b08b1 100644 --- a/polyfill/test/MonthDay/prototype/with/subclass-out-of-range.js +++ b/polyfill/test/MonthDay/prototype/with/subclass-out-of-range.js @@ -24,5 +24,5 @@ assert.sameValue(result.month, 11, "month result"); assert.sameValue(result.day, 30, "day result"); assert.sameValue(called, 2); -assert.throws(RangeError, () => instance.with({ day: 31 }, { disambiguation: "reject" })); +assert.throws(RangeError, () => instance.with({ day: 31 }, { overflow: "reject" })); assert.sameValue(called, 2); diff --git a/polyfill/test/Time/constructor/from/infinity-handled.js b/polyfill/test/Time/constructor/from/infinity-handled.js index 650ea50f9e..5b1c5fea5f 100644 --- a/polyfill/test/Time/constructor/from/infinity-handled.js +++ b/polyfill/test/Time/constructor/from/infinity-handled.js @@ -8,42 +8,42 @@ esid: sec-temporal.time.from // constrain -let result = Temporal.Time.from({ hour: Infinity }, { disambiguation: 'constrain' }); +let result = Temporal.Time.from({ hour: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 23); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ minute: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ minute: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 59); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ second: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ second: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 59); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ millisecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ millisecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 999); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ microsecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ microsecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 999); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ nanosecond: Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ nanosecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); @@ -53,12 +53,12 @@ assert.sameValue(result.nanosecond, 999); // reject -assert.throws(RangeError, () => Temporal.Time.from({ hour: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ minute: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ second: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ millisecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ microsecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ hour: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ minute: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ second: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ millisecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ microsecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -68,28 +68,28 @@ const obj = { } }; -result = Temporal.Time.from({ hour: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.Time.from({ minute: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Time.from({ second: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.Time.from({ millisecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.Time.from({ microsecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.Time.from({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/constructor/from/negative-infinity-handled.js b/polyfill/test/Time/constructor/from/negative-infinity-handled.js index 1aab955323..caaa06597f 100644 --- a/polyfill/test/Time/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/Time/constructor/from/negative-infinity-handled.js @@ -8,42 +8,42 @@ esid: sec-temporal.time.from // constrain -let result = Temporal.Time.from({ hour: -Infinity }, { disambiguation: 'constrain' }); +let result = Temporal.Time.from({ hour: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ minute: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ minute: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ second: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ second: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ millisecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ millisecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ microsecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ microsecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 0); -result = Temporal.Time.from({ nanosecond: -Infinity }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ nanosecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 0); @@ -53,12 +53,12 @@ assert.sameValue(result.nanosecond, 0); // reject -assert.throws(RangeError, () => Temporal.Time.from({ hour: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ minute: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ second: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ millisecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ microsecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ hour: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ minute: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ second: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ millisecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ microsecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -68,28 +68,28 @@ const obj = { } }; -result = Temporal.Time.from({ hour: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = Temporal.Time.from({ minute: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = Temporal.Time.from({ second: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = Temporal.Time.from({ millisecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = Temporal.Time.from({ microsecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = Temporal.Time.from({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = Temporal.Time.from({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.Time.from({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/constructor/from/subclass-invalid-arg.js b/polyfill/test/Time/constructor/from/subclass-invalid-arg.js index 66ca4505ec..ac6289d53f 100644 --- a/polyfill/test/Time/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/Time/constructor/from/subclass-invalid-arg.js @@ -14,6 +14,6 @@ class MyTime extends Temporal.Time { } } -assert.throws(RangeError, () => MyTime.from("23:61", { disambiguation: "reject" })); -assert.throws(RangeError, () => MyTime.from("24:01", { disambiguation: "reject" })); +assert.throws(RangeError, () => MyTime.from("23:61", { overflow: "reject" })); +assert.throws(RangeError, () => MyTime.from("24:01", { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/Time/prototype/minus/infinity-throws-rangeerror.js b/polyfill/test/Time/prototype/minus/infinity-throws-rangeerror.js index cee5481eba..c9cee6f002 100644 --- a/polyfill/test/Time/prototype/minus/infinity-throws-rangeerror.js +++ b/polyfill/test/Time/prototype/minus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Time.from({ hour: 12, minute: 34, second: 56, millisec // constrain -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/prototype/minus/negative-infinity-throws-rangeerror.js b/polyfill/test/Time/prototype/minus/negative-infinity-throws-rangeerror.js index 26b9379e72..5cf5529449 100644 --- a/polyfill/test/Time/prototype/minus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Time/prototype/minus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Time.from({ hour: 12, minute: 34, second: 56, millisec // constrain -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/prototype/plus/infinity-throws-rangeerror.js b/polyfill/test/Time/prototype/plus/infinity-throws-rangeerror.js index a85c191f2e..31b12ab7f3 100644 --- a/polyfill/test/Time/prototype/plus/infinity-throws-rangeerror.js +++ b/polyfill/test/Time/prototype/plus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Time.from({ hour: 12, minute: 34, second: 56, millisec // constrain -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/prototype/plus/negative-infinity-throws-rangeerror.js b/polyfill/test/Time/prototype/plus/negative-infinity-throws-rangeerror.js index bd38fd5aee..270e60ab55 100644 --- a/polyfill/test/Time/prototype/plus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/Time/prototype/plus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.Time.from({ hour: 12, minute: 34, second: 56, millisec // constrain -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/prototype/with/infinity-handled.js b/polyfill/test/Time/prototype/with/infinity-handled.js index 39e35dda6b..79ef594427 100644 --- a/polyfill/test/Time/prototype/with/infinity-handled.js +++ b/polyfill/test/Time/prototype/with/infinity-handled.js @@ -10,42 +10,42 @@ const instance = new Temporal.Time(12, 34, 56, 987, 654, 321); // constrain -let result = instance.with({ hour: Infinity }, { disambiguation: 'constrain' }); +let result = instance.with({ hour: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 23); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ minute: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ minute: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 59); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ second: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ second: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 59); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ millisecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 999); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ microsecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 999); assert.sameValue(result.nanosecond, 321); -result = instance.with({ nanosecond: Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); @@ -55,12 +55,12 @@ assert.sameValue(result.nanosecond, 999); // reject -assert.throws(RangeError, () => instance.with({ hour: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minute: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ second: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ millisecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microsecond: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanosecond: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -70,28 +70,28 @@ const obj = { } }; -result = instance.with({ hour: obj }, { disambiguation: 'constrain' }); +result = instance.with({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = instance.with({ minute: obj }, { disambiguation: 'constrain' }); +result = instance.with({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ second: obj }, { disambiguation: 'constrain' }); +result = instance.with({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = instance.with({ millisecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = instance.with({ microsecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = instance.with({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); diff --git a/polyfill/test/Time/prototype/with/negative-infinity-handled.js b/polyfill/test/Time/prototype/with/negative-infinity-handled.js index d96b55f14b..02d8ea5e0e 100644 --- a/polyfill/test/Time/prototype/with/negative-infinity-handled.js +++ b/polyfill/test/Time/prototype/with/negative-infinity-handled.js @@ -10,42 +10,42 @@ const instance = new Temporal.Time(12, 34, 56, 987, 654, 321); // constrain -let result = instance.with({ hour: -Infinity }, { disambiguation: 'constrain' }); +let result = instance.with({ hour: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 0); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ minute: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ minute: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 0); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ second: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ second: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 0); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ millisecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 0); assert.sameValue(result.microsecond, 654); assert.sameValue(result.nanosecond, 321); -result = instance.with({ microsecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); assert.sameValue(result.millisecond, 987); assert.sameValue(result.microsecond, 0); assert.sameValue(result.nanosecond, 321); -result = instance.with({ nanosecond: -Infinity }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.hour, 12); assert.sameValue(result.minute, 34); assert.sameValue(result.second, 56); @@ -55,12 +55,12 @@ assert.sameValue(result.nanosecond, 0); // reject -assert.throws(RangeError, () => instance.with({ hour: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ minute: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ second: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ millisecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ microsecond: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ nanosecond: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -70,28 +70,28 @@ const obj = { } }; -result = instance.with({ hour: obj }, { disambiguation: 'constrain' }); +result = instance.with({ hour: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 1, "it fetches the primitive value"); -result = instance.with({ minute: obj }, { disambiguation: 'constrain' }); +result = instance.with({ minute: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -result = instance.with({ second: obj }, { disambiguation: 'constrain' }); +result = instance.with({ second: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 3, "it fetches the primitive value"); -result = instance.with({ millisecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ millisecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 4, "it fetches the primitive value"); -result = instance.with({ microsecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ microsecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 5, "it fetches the primitive value"); -result = instance.with({ nanosecond: obj }, { disambiguation: 'constrain' }); +result = instance.with({ nanosecond: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 6, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ hour: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ hour: obj }, { overflow: 'reject' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ minute: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ minute: obj }, { overflow: 'reject' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ second: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ second: obj }, { overflow: 'reject' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ millisecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ millisecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ microsecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ microsecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ nanosecond: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/constructor/from/infinity-handled.js b/polyfill/test/YearMonth/constructor/from/infinity-handled.js index c44cd28e64..0745e3d3f5 100644 --- a/polyfill/test/YearMonth/constructor/from/infinity-handled.js +++ b/polyfill/test/YearMonth/constructor/from/infinity-handled.js @@ -8,15 +8,15 @@ esid: sec-temporal.yearmonth.from // constrain -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: Infinity, month: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.YearMonth.from({ year: 1970, month: Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: Infinity, month: 1 }, { overflow: 'constrain' })); +let result = Temporal.YearMonth.from({ year: 1970, month: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 12); // reject -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: Infinity, month: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: Infinity, month: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -26,12 +26,12 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.YearMonth.from({ year: 1970, month: obj }, { disambiguation: 'constrain' }); +result = Temporal.YearMonth.from({ year: 1970, month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/constructor/from/negative-infinity-handled.js b/polyfill/test/YearMonth/constructor/from/negative-infinity-handled.js index 87792f700e..1681dd59f5 100644 --- a/polyfill/test/YearMonth/constructor/from/negative-infinity-handled.js +++ b/polyfill/test/YearMonth/constructor/from/negative-infinity-handled.js @@ -8,15 +8,15 @@ esid: sec-temporal.yearmonth.from // constrain -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: -Infinity, month: 1 }, { disambiguation: 'constrain' })); -let result = Temporal.YearMonth.from({ year: 1970, month: -Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: -Infinity, month: 1 }, { overflow: 'constrain' })); +let result = Temporal.YearMonth.from({ year: 1970, month: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 1970); assert.sameValue(result.month, 1); // reject -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: -Infinity, month: 1 }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: -Infinity, month: 1 }, { overflow: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -26,12 +26,12 @@ const obj = { } }; -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = Temporal.YearMonth.from({ year: 1970, month: obj }, { disambiguation: 'constrain' }); +result = Temporal.YearMonth.from({ year: 1970, month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: obj, month: 1 }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => Temporal.YearMonth.from({ year: 1970, month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/constructor/from/subclass-invalid-arg.js b/polyfill/test/YearMonth/constructor/from/subclass-invalid-arg.js index 275338ee39..e50856277e 100644 --- a/polyfill/test/YearMonth/constructor/from/subclass-invalid-arg.js +++ b/polyfill/test/YearMonth/constructor/from/subclass-invalid-arg.js @@ -14,5 +14,5 @@ class MyYearMonth extends Temporal.YearMonth { } } -assert.throws(RangeError, () => MyYearMonth.from({ year: 2020, month: 13 }, { disambiguation: "reject" })); +assert.throws(RangeError, () => MyYearMonth.from({ year: 2020, month: 13 }, { overflow: "reject" })); assert.sameValue(called, false); diff --git a/polyfill/test/YearMonth/prototype/minus/infinity-throws-rangeerror.js b/polyfill/test/YearMonth/prototype/minus/infinity-throws-rangeerror.js index f772a346ee..9983967ad1 100644 --- a/polyfill/test/YearMonth/prototype/minus/infinity-throws-rangeerror.js +++ b/polyfill/test/YearMonth/prototype/minus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.YearMonth.from({ year: 2000, month: 5 }); // constrain -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/prototype/minus/negative-infinity-throws-rangeerror.js b/polyfill/test/YearMonth/prototype/minus/negative-infinity-throws-rangeerror.js index 4eaf779b6c..c7163c72ff 100644 --- a/polyfill/test/YearMonth/prototype/minus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/YearMonth/prototype/minus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.YearMonth.from({ year: 2000, month: 5 }); // constrain -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.minus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/prototype/plus/infinity-throws-rangeerror.js b/polyfill/test/YearMonth/prototype/plus/infinity-throws-rangeerror.js index 6f37309b86..3af4594b27 100644 --- a/polyfill/test/YearMonth/prototype/plus/infinity-throws-rangeerror.js +++ b/polyfill/test/YearMonth/prototype/plus/infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.YearMonth.from({ year: 2000, month: 5 }); // constrain -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/prototype/plus/negative-infinity-throws-rangeerror.js b/polyfill/test/YearMonth/prototype/plus/negative-infinity-throws-rangeerror.js index b4321151b4..f76b391717 100644 --- a/polyfill/test/YearMonth/prototype/plus/negative-infinity-throws-rangeerror.js +++ b/polyfill/test/YearMonth/prototype/plus/negative-infinity-throws-rangeerror.js @@ -10,29 +10,29 @@ const instance = Temporal.YearMonth.from({ year: 2000, month: 5 }); // constrain -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'constrain' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'constrain' })); // reject -assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -42,44 +42,44 @@ const obj = { } }; -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 2, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 5, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 6, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 7, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 8, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 9, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 10, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ years: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ years: obj }, { overflow: 'reject' })); assert.sameValue(calls, 11, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ months: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ months: obj }, { overflow: 'reject' })); assert.sameValue(calls, 12, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ weeks: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ weeks: obj }, { overflow: 'reject' })); assert.sameValue(calls, 13, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ days: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ days: obj }, { overflow: 'reject' })); assert.sameValue(calls, 14, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ hours: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ hours: obj }, { overflow: 'reject' })); assert.sameValue(calls, 15, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ minutes: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ minutes: obj }, { overflow: 'reject' })); assert.sameValue(calls, 16, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ seconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ seconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 17, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ milliseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 18, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ microseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 19, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.plus({ nanoseconds: obj }, { overflow: 'reject' })); assert.sameValue(calls, 20, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/prototype/with/infinity-handled.js b/polyfill/test/YearMonth/prototype/with/infinity-handled.js index 79b7906792..625e3a4d40 100644 --- a/polyfill/test/YearMonth/prototype/with/infinity-handled.js +++ b/polyfill/test/YearMonth/prototype/with/infinity-handled.js @@ -10,15 +10,15 @@ const instance = new Temporal.YearMonth(2000, 5); // constrain -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 12); // reject -assert.throws(RangeError, () => instance.with({ year: Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -28,12 +28,12 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/YearMonth/prototype/with/negative-infinity-handled.js b/polyfill/test/YearMonth/prototype/with/negative-infinity-handled.js index aa609394f0..f8582e5a6a 100644 --- a/polyfill/test/YearMonth/prototype/with/negative-infinity-handled.js +++ b/polyfill/test/YearMonth/prototype/with/negative-infinity-handled.js @@ -10,15 +10,15 @@ const instance = new Temporal.YearMonth(2000, 5); // constrain -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'constrain' })); -let result = instance.with({ month: -Infinity }, { disambiguation: 'constrain' }); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'constrain' })); +let result = instance.with({ month: -Infinity }, { overflow: 'constrain' }); assert.sameValue(result.year, 2000); assert.sameValue(result.month, 1); // reject -assert.throws(RangeError, () => instance.with({ year: -Infinity }, { disambiguation: 'reject' })); -assert.throws(RangeError, () => instance.with({ month: -Infinity }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: -Infinity }, { overflow: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: -Infinity }, { overflow: 'reject' })); let calls = 0; const obj = { @@ -28,12 +28,12 @@ const obj = { } }; -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'constrain' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'constrain' })); assert.sameValue(calls, 1, "it fails after fetching the primitive value"); -result = instance.with({ month: obj }, { disambiguation: 'constrain' }); +result = instance.with({ month: obj }, { overflow: 'constrain' }); assert.sameValue(calls, 2, "it fetches the primitive value"); -assert.throws(RangeError, () => instance.with({ year: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ year: obj }, { overflow: 'reject' })); assert.sameValue(calls, 3, "it fails after fetching the primitive value"); -assert.throws(RangeError, () => instance.with({ month: obj }, { disambiguation: 'reject' })); +assert.throws(RangeError, () => instance.with({ month: obj }, { overflow: 'reject' })); assert.sameValue(calls, 4, "it fails after fetching the primitive value"); diff --git a/polyfill/test/date.mjs b/polyfill/test/date.mjs index 19f9aa1c3a..c1ad559545 100644 --- a/polyfill/test/date.mjs +++ b/polyfill/test/date.mjs @@ -147,9 +147,9 @@ describe('Date', () => { const date = original.with(Temporal.YearMonth.from('1977-10')); equal(`${date}`, '1977-10-18'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => original.with({ day: 17 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => original.with({ day: 17 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -293,14 +293,14 @@ describe('Date', () => { it('date.plus(durationObj)', () => { equal(`${date.plus(Temporal.Duration.from('P43Y'))}`, '2019-11-18'); }); - it('constrain when ambiguous result', () => { + it('constrain when overflowing result', () => { const jan31 = Date.from('2020-01-31'); equal(`${jan31.plus({ months: 1 })}`, '2020-02-29'); - equal(`${jan31.plus({ months: 1 }, { disambiguation: 'constrain' })}`, '2020-02-29'); + equal(`${jan31.plus({ months: 1 }, { overflow: 'constrain' })}`, '2020-02-29'); }); - it('throw when ambiguous result with reject', () => { + it('throw when overflowing result with reject', () => { const jan31 = Date.from('2020-01-31'); - throws(() => jan31.plus({ months: 1 }, { disambiguation: 'reject' }), RangeError); + throws(() => jan31.plus({ months: 1 }, { overflow: 'reject' }), RangeError); }); it('symmetrical with regard to negative durations', () => { equal(`${Date.from('2019-11-18').plus({ years: -43 })}`, '1976-11-18'); @@ -326,14 +326,14 @@ describe('Date', () => { equal(`${date.plus({ microseconds: 86400_000_000 })}`, '1976-11-19'); equal(`${date.plus({ nanoseconds: 86400_000_000_000 })}`, '1976-11-19'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => date.plus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => date.plus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => date.plus({ months: 1, days: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => date.plus({ months: 1, days: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -360,14 +360,14 @@ describe('Date', () => { it('Date.minus(durationObj)', () => { equal(`${date.minus(Temporal.Duration.from('P43Y'))}`, '1976-11-18'); }); - it('constrain when ambiguous result', () => { + it('constrain when overflowing result', () => { const mar31 = Date.from('2020-03-31'); equal(`${mar31.minus({ months: 1 })}`, '2020-02-29'); - equal(`${mar31.minus({ months: 1 }, { disambiguation: 'constrain' })}`, '2020-02-29'); + equal(`${mar31.minus({ months: 1 }, { overflow: 'constrain' })}`, '2020-02-29'); }); - it('throw when ambiguous result with reject', () => { + it('throw when overflowing result with reject', () => { const mar31 = Date.from('2020-03-31'); - throws(() => mar31.minus({ months: 1 }, { disambiguation: 'reject' }), RangeError); + throws(() => mar31.minus({ months: 1 }, { overflow: 'reject' }), RangeError); }); it('symmetrical with regard to negative durations', () => { equal(`${Date.from('1976-11-18').minus({ years: -43 })}`, '2019-11-18'); @@ -393,14 +393,14 @@ describe('Date', () => { equal(`${date.minus({ microseconds: 86400_000_000 })}`, '2019-11-17'); equal(`${date.minus({ nanoseconds: 86400_000_000_000 })}`, '2019-11-17'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => date.minus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => date.minus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => date.minus({ months: 1, days: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => date.minus({ months: 1, days: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -497,17 +497,17 @@ describe('Date', () => { equal(`${Date.from({ year: 1976, month: 11, day: 18 }, options)}`, '1976-11-18') ); }); - describe('Disambiguation', () => { + describe('Overflow', () => { const bad = { year: 2019, month: 1, day: 32 }; - it('reject', () => throws(() => Date.from(bad, { disambiguation: 'reject' }), RangeError)); + it('reject', () => throws(() => Date.from(bad, { overflow: 'reject' }), RangeError)); it('constrain', () => { equal(`${Date.from(bad)}`, '2019-01-31'); - equal(`${Date.from(bad, { disambiguation: 'constrain' })}`, '2019-01-31'); + equal(`${Date.from(bad, { overflow: 'constrain' })}`, '2019-01-31'); }); - it('throw when bad disambiguation', () => { + it('throw when bad overflow', () => { [new Date(1976, 11, 18), { year: 2019, month: 1, day: 1 }, '2019-01-31'].forEach((input) => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => Date.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => Date.from(input, { overflow }), RangeError) ); }); }); @@ -559,18 +559,18 @@ describe('Date', () => { it('constructing from property bag', () => { const tooEarly = { year: -271821, month: 4, day: 18 }; const tooLate = { year: 275760, month: 9, day: 14 }; - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { [tooEarly, tooLate].forEach((props) => { - throws(() => Date.from(props, { disambiguation }), RangeError); + throws(() => Date.from(props, { overflow }), RangeError); }); }); equal(`${Date.from({ year: -271821, month: 4, day: 19 })}`, '-271821-04-19'); equal(`${Date.from({ year: 275760, month: 9, day: 13 })}`, '+275760-09-13'); }); it('constructing from ISO string', () => { - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { ['-271821-04-18', '+275760-09-14'].forEach((str) => { - throws(() => Date.from(str, { disambiguation }), RangeError); + throws(() => Date.from(str, { overflow }), RangeError); }); }); equal(`${Date.from('-271821-04-19')}`, '-271821-04-19'); @@ -603,9 +603,9 @@ describe('Date', () => { it('adding and subtracting beyond limit', () => { const min = Date.from('-271821-04-19'); const max = Date.from('+275760-09-13'); - ['reject', 'constrain'].forEach((disambiguation) => { - throws(() => min.minus({ days: 1 }, { disambiguation }), RangeError); - throws(() => max.plus({ days: 1 }, { disambiguation }), RangeError); + ['reject', 'constrain'].forEach((overflow) => { + throws(() => min.minus({ days: 1 }, { overflow }), RangeError); + throws(() => max.plus({ days: 1 }, { overflow }), RangeError); }); }); }); diff --git a/polyfill/test/datemath.mjs b/polyfill/test/datemath.mjs index 3064e62df1..704ab13ddb 100644 --- a/polyfill/test/datemath.mjs +++ b/polyfill/test/datemath.mjs @@ -70,11 +70,11 @@ function buildSub(one, two, largestUnits) { largestUnits.forEach((largestUnit) => { describe(`< ${one} : ${two} (${largestUnit})>`, () => { const dif = two.difference(one, { largestUnit }); - const disambiguation = 'reject'; - it(`(${one}).plus(${dif}) => ${two}`, () => assert(one.plus(dif, { disambiguation }).equals(two))); - it(`(${two}).minus(${dif}) => ${one}`, () => assert(two.minus(dif, { disambiguation }).equals(one))); - it(`(${one}).minus(-${dif}) => ${two}`, () => assert(one.minus(dif.negated(), { disambiguation }).equals(two))); - it(`(${two}).plus(-${dif}) => ${one}`, () => assert(two.plus(dif.negated(), { disambiguation }).equals(one))); + const overflow = 'reject'; + it(`(${one}).plus(${dif}) => ${two}`, () => assert(one.plus(dif, { overflow }).equals(two))); + it(`(${two}).minus(${dif}) => ${one}`, () => assert(two.minus(dif, { overflow }).equals(one))); + it(`(${one}).minus(-${dif}) => ${two}`, () => assert(one.minus(dif.negated(), { overflow }).equals(two))); + it(`(${two}).plus(-${dif}) => ${one}`, () => assert(two.plus(dif.negated(), { overflow }).equals(one))); }); }); } diff --git a/polyfill/test/datetime.mjs b/polyfill/test/datetime.mjs index 88cf022236..7c5ec9e189 100644 --- a/polyfill/test/datetime.mjs +++ b/polyfill/test/datetime.mjs @@ -288,9 +288,9 @@ describe('DateTime', () => { const ym = Temporal.YearMonth.from('1977-10'); equal(`${datetime.with(ym)}`, '1977-10-18T15:23:30.123456789'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => datetime.with({ day: 5 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => datetime.with({ day: 5 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -373,23 +373,23 @@ describe('DateTime', () => { const jan31 = DateTime.from('2020-01-31T15:00'); it('constrain when ambiguous result', () => { equal(`${jan31.plus({ months: 1 })}`, '2020-02-29T15:00'); - equal(`${jan31.plus({ months: 1 }, { disambiguation: 'constrain' })}`, '2020-02-29T15:00'); + equal(`${jan31.plus({ months: 1 }, { overflow: 'constrain' })}`, '2020-02-29T15:00'); }); it('symmetrical with regard to negative durations in the time part', () => { equal(`${jan31.plus({ minutes: -30 })}`, '2020-01-31T14:30'); equal(`${jan31.plus({ seconds: -30 })}`, '2020-01-31T14:59:30'); }); it('throw when ambiguous result with reject', () => { - throws(() => jan31.plus({ months: 1 }, { disambiguation: 'reject' }), RangeError); + throws(() => jan31.plus({ months: 1 }, { overflow: 'reject' }), RangeError); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => DateTime.from('2019-11-18T15:00').plus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => DateTime.from('2019-11-18T15:00').plus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => jan31.plus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => jan31.plus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -403,23 +403,23 @@ describe('DateTime', () => { const mar31 = DateTime.from('2020-03-31T15:00'); it('constrain when ambiguous result', () => { equal(`${mar31.minus({ months: 1 })}`, '2020-02-29T15:00'); - equal(`${mar31.minus({ months: 1 }, { disambiguation: 'constrain' })}`, '2020-02-29T15:00'); + equal(`${mar31.minus({ months: 1 }, { overflow: 'constrain' })}`, '2020-02-29T15:00'); }); it('symmetrical with regard to negative durations in the time part', () => { equal(`${mar31.minus({ minutes: -30 })}`, '2020-03-31T15:30'); equal(`${mar31.minus({ seconds: -30 })}`, '2020-03-31T15:00:30'); }); it('throw when ambiguous result with reject', () => { - throws(() => mar31.minus({ months: 1 }, { disambiguation: 'reject' }), RangeError); + throws(() => mar31.minus({ months: 1 }, { overflow: 'reject' }), RangeError); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => DateTime.from('2019-11-18T15:00').minus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => DateTime.from('2019-11-18T15:00').minus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => mar31.plus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => mar31.plus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -529,22 +529,22 @@ describe('DateTime', () => { }); it('DateTime.from(number) is converted to string', () => assert(DateTime.from(19761118).equals(DateTime.from('19761118')))); - describe('Disambiguation', () => { + describe('Overflow', () => { const bad = { year: 2019, month: 1, day: 32 }; - it('reject', () => throws(() => DateTime.from(bad, { disambiguation: 'reject' }), RangeError)); + it('reject', () => throws(() => DateTime.from(bad, { overflow: 'reject' }), RangeError)); it('constrain', () => { equal(`${DateTime.from(bad)}`, '2019-01-31T00:00'); - equal(`${DateTime.from(bad, { disambiguation: 'constrain' })}`, '2019-01-31T00:00'); + equal(`${DateTime.from(bad, { overflow: 'constrain' })}`, '2019-01-31T00:00'); }); - it('throw when bad disambiguation', () => { + it('throw when bad overflow', () => { [new DateTime(1976, 11, 18, 15, 23), { year: 2019, month: 1, day: 1 }, '2019-01-31T00:00'].forEach((input) => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => DateTime.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => DateTime.from(input, { overflow }), RangeError) ); }); }); const leap = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 }; - it('reject leap second', () => throws(() => DateTime.from(leap, { disambiguation: 'reject' }), RangeError)); + it('reject leap second', () => throws(() => DateTime.from(leap, { overflow: 'reject' }), RangeError)); it('constrain leap second', () => equal(`${DateTime.from(leap)}`, '2016-12-31T23:59:59')); }); it('variant time separators', () => { @@ -668,9 +668,9 @@ describe('DateTime', () => { it('constructing from property bag', () => { const tooEarly = { year: -271821, month: 4, day: 19 }; const tooLate = { year: 275760, month: 9, day: 14 }; - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { [tooEarly, tooLate].forEach((props) => { - throws(() => DateTime.from(props, { disambiguation }), RangeError); + throws(() => DateTime.from(props, { overflow }), RangeError); }); }); equal( @@ -693,9 +693,9 @@ describe('DateTime', () => { ); }); it('constructing from ISO string', () => { - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { ['-271821-04-19T00:00', '+275760-09-14T00:00'].forEach((str) => { - throws(() => DateTime.from(str, { disambiguation }), RangeError); + throws(() => DateTime.from(str, { overflow }), RangeError); }); }); equal(`${DateTime.from('-271821-04-19T00:00:00.000000001')}`, '-271821-04-19T00:00:00.000000001'); @@ -723,9 +723,9 @@ describe('DateTime', () => { it('adding and subtracting beyond limit', () => { const min = DateTime.from('-271821-04-19T00:00:00.000000001'); const max = DateTime.from('+275760-09-13T23:59:59.999999999'); - ['reject', 'constrain'].forEach((disambiguation) => { - throws(() => min.minus({ nanoseconds: 1 }, { disambiguation }), RangeError); - throws(() => max.plus({ nanoseconds: 1 }, { disambiguation }), RangeError); + ['reject', 'constrain'].forEach((overflow) => { + throws(() => min.minus({ nanoseconds: 1 }, { overflow }), RangeError); + throws(() => max.plus({ nanoseconds: 1 }, { overflow }), RangeError); }); }); }); diff --git a/polyfill/test/duration.mjs b/polyfill/test/duration.mjs index 84f0ace09a..50f5c20cf7 100644 --- a/polyfill/test/duration.mjs +++ b/polyfill/test/duration.mjs @@ -173,38 +173,38 @@ describe('Duration', () => { ); [{}, () => {}, undefined].forEach((options) => equal(Duration.from({ hours: 1 }, options).hours, 1)); }); - describe('Disambiguation', () => { + describe('Overflow', () => { it('mixed positive and negative values always throw', () => { - ['constrain', 'balance', 'reject'].forEach((disambiguation) => - throws(() => Duration.from({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'balance', 'reject'].forEach((overflow) => + throws(() => Duration.from({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('excessive values unchanged when "reject"', () => { - equal(`${Duration.from({ minutes: 100 }, { disambiguation: 'reject' })}`, 'PT100M'); + equal(`${Duration.from({ minutes: 100 }, { overflow: 'reject' })}`, 'PT100M'); }); it('excessive values unchanged when "constrain"', () => { - equal(`${Duration.from({ minutes: 100 }, { disambiguation: 'constrain' })}`, 'PT100M'); + equal(`${Duration.from({ minutes: 100 }, { overflow: 'constrain' })}`, 'PT100M'); }); it('excessive time units balance when "balance"', () => { - equal(`${Duration.from({ nanoseconds: 1000 }, { disambiguation: 'balance' })}`, 'PT0.000001S'); - equal(`${Duration.from({ microseconds: 1000 }, { disambiguation: 'balance' })}`, 'PT0.001S'); - equal(`${Duration.from({ milliseconds: 1000 }, { disambiguation: 'balance' })}`, 'PT1S'); - equal(`${Duration.from({ seconds: 100 }, { disambiguation: 'balance' })}`, 'PT1M40S'); - equal(`${Duration.from({ minutes: 100 }, { disambiguation: 'balance' })}`, 'PT1H40M'); - equal(`${Duration.from({ hours: 100 }, { disambiguation: 'balance' })}`, 'P4DT4H'); + equal(`${Duration.from({ nanoseconds: 1000 }, { overflow: 'balance' })}`, 'PT0.000001S'); + equal(`${Duration.from({ microseconds: 1000 }, { overflow: 'balance' })}`, 'PT0.001S'); + equal(`${Duration.from({ milliseconds: 1000 }, { overflow: 'balance' })}`, 'PT1S'); + equal(`${Duration.from({ seconds: 100 }, { overflow: 'balance' })}`, 'PT1M40S'); + equal(`${Duration.from({ minutes: 100 }, { overflow: 'balance' })}`, 'PT1H40M'); + equal(`${Duration.from({ hours: 100 }, { overflow: 'balance' })}`, 'P4DT4H'); }); it('excessive date units do not balance when "balance"', () => { - equal(`${Duration.from({ months: 12 }, { disambiguation: 'balance' })}`, 'P12M'); - equal(`${Duration.from({ months: 12, seconds: 3600 }, { disambiguation: 'balance' })}`, 'P12MT1H'); - equal(`${Duration.from({ weeks: 6 }, { disambiguation: 'balance' })}`, 'P6W'); - equal(`${Duration.from({ weeks: 6, seconds: 3600 }, { disambiguation: 'balance' })}`, 'P6WT1H'); - equal(`${Duration.from({ days: 31 }, { disambiguation: 'balance' })}`, 'P31D'); - equal(`${Duration.from({ days: 31, seconds: 3600 }, { disambiguation: 'balance' })}`, 'P31DT1H'); + equal(`${Duration.from({ months: 12 }, { overflow: 'balance' })}`, 'P12M'); + equal(`${Duration.from({ months: 12, seconds: 3600 }, { overflow: 'balance' })}`, 'P12MT1H'); + equal(`${Duration.from({ weeks: 6 }, { overflow: 'balance' })}`, 'P6W'); + equal(`${Duration.from({ weeks: 6, seconds: 3600 }, { overflow: 'balance' })}`, 'P6WT1H'); + equal(`${Duration.from({ days: 31 }, { overflow: 'balance' })}`, 'P31D'); + equal(`${Duration.from({ days: 31, seconds: 3600 }, { overflow: 'balance' })}`, 'P31DT1H'); }); - it('throw when bad disambiguation', () => { + it('throw on bad overflow', () => { [new Duration(3), { days: 0 }, 'P5Y'].forEach((input) => { - ['', 'CONSTRAIN', 'xyz', 3, null].forEach((disambiguation) => - throws(() => Duration.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'xyz', 3, null].forEach((overflow) => + throws(() => Duration.from(input, { overflow }), RangeError) ); }); }); @@ -259,7 +259,7 @@ describe('Duration', () => { it('unrepresentable number is not allowed', () => { units.forEach((unit, ix) => { throws(() => new Duration(...Array(ix).fill(0), 1e309), RangeError); - throws(() => Duration.from({ [unit]: 1e309 }, { disambiguation: 'reject' }), RangeError); + throws(() => Duration.from({ [unit]: 1e309 }, { overflow: 'reject' }), RangeError); }); const manyNines = '9'.repeat(309); [ @@ -270,7 +270,7 @@ describe('Duration', () => { `PT${manyNines}H`, `PT${manyNines}M`, `PT${manyNines}S` - ].forEach((str) => throws(() => Duration.from(str, { disambiguation: 'reject' }), RangeError)); + ].forEach((str) => throws(() => Duration.from(str, { overflow: 'reject' }), RangeError)); }); it('max safe integer is allowed', () => { [ @@ -286,7 +286,7 @@ describe('Duration', () => { 'PT9007199.254740991S' ].forEach((str, ix) => { equal(`${new Duration(...Array(ix).fill(0), Number.MAX_SAFE_INTEGER)}`, str); - equal(`${Duration.from({ [units[ix]]: Number.MAX_SAFE_INTEGER }, { disambiguation: 'reject' })}`, str); + equal(`${Duration.from({ [units[ix]]: Number.MAX_SAFE_INTEGER }, { overflow: 'reject' })}`, str); equal(`${Duration.from(str)}`, str); }); }); @@ -360,7 +360,7 @@ describe('Duration', () => { microseconds: 3000, nanoseconds: 3001 }, - { disambiguation: 'balance' } + { overflow: 'balance' } ); equal(result.years, 5); equal(result.months, 5); @@ -373,8 +373,8 @@ describe('Duration', () => { equal(result.nanoseconds, 1); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'balance', 'reject'].forEach((disambiguation) => - throws(() => duration.with({ hours: 1, minutes: -1 }, { disambiguation }), RangeError) + ['constrain', 'balance', 'reject'].forEach((overflow) => + throws(() => duration.with({ hours: 1, minutes: -1 }, { overflow }), RangeError) ); }); it('can reverse the sign if all the fields are replaced', () => { @@ -387,9 +387,9 @@ describe('Duration', () => { const d = Duration.from({ years: 5, days: 1 }); throws(() => d.with({ months: -5, minutes: 0 }), RangeError); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'xyz', 3, null].forEach((disambiguation) => - throws(() => duration.with({ days: 5 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'xyz', 3, null].forEach((overflow) => + throws(() => duration.with({ days: 5 }, { overflow }), RangeError) ); }); it('sign cannot be manipulated independently', () => { @@ -412,10 +412,7 @@ describe('Duration', () => { }); it('symmetric with regard to negative durations', () => { equal(`${Duration.from('P3DT10M').plus({ days: -2, minutes: -5 })}`, 'P1DT5M'); - equal( - `${Duration.from('P1DT12H5M30S').plus({ hours: -12, seconds: -30 }, { disambiguation: 'balance' })}`, - 'P1DT5M' - ); + equal(`${Duration.from('P1DT12H5M30S').plus({ hours: -12, seconds: -30 }, { overflow: 'balance' })}`, 'P1DT5M'); }); it('does not balance units', () => { const d = Duration.from('P50M50W50DT50H50M50.500500500S'); @@ -445,7 +442,7 @@ describe('Duration', () => { equal(result.nanoseconds, Number.MAX_VALUE); }); it('caps values at Number.MAX_VALUE with constrain', () => { - const result = max.plus(max, { disambiguation: 'constrain' }); + const result = max.plus(max, { overflow: 'constrain' }); equal(result.years, Number.MAX_VALUE); equal(result.months, Number.MAX_VALUE); equal(result.weeks, Number.MAX_VALUE); @@ -458,16 +455,16 @@ describe('Duration', () => { equal(result.nanoseconds, Number.MAX_VALUE); }); it('throws if values become infinite with reject', () => { - throws(() => max.plus(max, { disambiguation: 'reject' }), RangeError); + throws(() => max.plus(max, { overflow: 'reject' }), RangeError); }); - it('throws on invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balanceConstrain', 3, null].forEach((disambiguation) => - throws(() => duration.plus(duration, { disambiguation }), RangeError) + it('throws on invalid overflow', () => { + ['', 'CONSTRAIN', 'balanceConstrain', 3, null].forEach((overflow) => + throws(() => duration.plus(duration, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'balance', 'reject'].forEach((disambiguation) => - throws(() => duration.plus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'balance', 'reject'].forEach((overflow) => + throws(() => duration.plus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -498,8 +495,8 @@ describe('Duration', () => { equal(`${new Duration().minus({ days: -3, hours: -1, minutes: -10 })}`, 'P3DT1H10M'); equal(`${Duration.from('PT1H10M').minus({ days: -3 })}`, 'P3DT1H10M'); equal(`${Duration.from('P3DT1H').minus({ minutes: -10 })}`, 'P3DT1H10M'); - equal(`${Duration.from('P3DT55M').minus({ minutes: -15 }, { disambiguation: 'balance' })}`, 'P3DT1H10M'); - equal(`${Duration.from('P3DT1H9M30S').minus({ seconds: -30 }, { disambiguation: 'balance' })}`, 'P3DT1H10M'); + equal(`${Duration.from('P3DT55M').minus({ minutes: -15 }, { overflow: 'balance' })}`, 'P3DT1H10M'); + equal(`${Duration.from('P3DT1H9M30S').minus({ seconds: -30 }, { overflow: 'balance' })}`, 'P3DT1H10M'); }); it('never balances positive units in constrain mode', () => { const d = Duration.from({ @@ -523,7 +520,7 @@ describe('Duration', () => { equal(result.microseconds, 1500); equal(result.nanoseconds, 1500); - result = d.minus(less, { disambiguation: 'constrain' }); + result = d.minus(less, { overflow: 'constrain' }); equal(result.minutes, 90); equal(result.seconds, 90); equal(result.milliseconds, 1500); @@ -545,7 +542,7 @@ describe('Duration', () => { microseconds: 500, nanoseconds: 500 }); - const result = d.minus(less, { disambiguation: 'balance' }); + const result = d.minus(less, { overflow: 'balance' }); equal(result.hours, 1); equal(result.minutes, 31); equal(result.seconds, 31); @@ -568,23 +565,23 @@ describe('Duration', () => { equal(result.minutes, -5); }); it('throws if result cannot be determined to be positive or negative', () => { - ['constrain', 'balance'].forEach((disambiguation) => { - throws(() => tenYears.minus({ months: 5 }, { disambiguation }), RangeError); - throws(() => tenYears.minus({ weeks: 5 }, { disambiguation }), RangeError); - throws(() => tenYears.minus({ days: 5 }, { disambiguation }), RangeError); - throws(() => tenYears.minus({ hours: 5 }, { disambiguation }), RangeError); - throws(() => tenYears.minus({ minutes: 5 }, { disambiguation }), RangeError); - throws(() => tenYears.minus({ seconds: 5 }, { disambiguation }), RangeError); + ['constrain', 'balance'].forEach((overflow) => { + throws(() => tenYears.minus({ months: 5 }, { overflow }), RangeError); + throws(() => tenYears.minus({ weeks: 5 }, { overflow }), RangeError); + throws(() => tenYears.minus({ days: 5 }, { overflow }), RangeError); + throws(() => tenYears.minus({ hours: 5 }, { overflow }), RangeError); + throws(() => tenYears.minus({ minutes: 5 }, { overflow }), RangeError); + throws(() => tenYears.minus({ seconds: 5 }, { overflow }), RangeError); }); }); - it('throws on invalid disambiguation', () => { - ['', 'BALANCE', 'xyz', 3, null].forEach((disambiguation) => - throws(() => duration.minus(duration, { disambiguation }), RangeError) + it('throws on invalid overflow', () => { + ['', 'BALANCE', 'xyz', 3, null].forEach((overflow) => + throws(() => duration.minus(duration, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'balance', 'reject'].forEach((disambiguation) => - throws(() => duration.minus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'balance', 'reject'].forEach((overflow) => + throws(() => duration.minus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { diff --git a/polyfill/test/monthday.mjs b/polyfill/test/monthday.mjs index 735d6501e8..7dd8922af4 100644 --- a/polyfill/test/monthday.mjs +++ b/polyfill/test/monthday.mjs @@ -90,24 +90,24 @@ describe('MonthDay', () => { equal(`${MonthDay.from({ month: 11, day: 18 }, options)}`, '11-18') ); }); - describe('Disambiguation', () => { + describe('Overflow', () => { const bad = { month: 1, day: 32 }; - it('reject', () => throws(() => MonthDay.from(bad, { disambiguation: 'reject' }), RangeError)); + it('reject', () => throws(() => MonthDay.from(bad, { overflow: 'reject' }), RangeError)); it('constrain', () => { equal(`${MonthDay.from(bad)}`, '01-31'); - equal(`${MonthDay.from(bad, { disambiguation: 'constrain' })}`, '01-31'); + equal(`${MonthDay.from(bad, { overflow: 'constrain' })}`, '01-31'); }); - it('throw when bad disambiguation', () => { + it('throw on bad overflow', () => { [new MonthDay(11, 18), { month: 1, day: 1 }, '01-31'].forEach((input) => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => MonthDay.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => MonthDay.from(input, { overflow }), RangeError) ); }); }); }); describe('Leap day', () => { - ['reject', 'constrain'].forEach((disambiguation) => - it(disambiguation, () => equal(`${MonthDay.from({ month: 2, day: 29 }, { disambiguation })}`, '02-29')) + ['reject', 'constrain'].forEach((overflow) => + it(overflow, () => equal(`${MonthDay.from({ month: 2, day: 29 }, { overflow })}`, '02-29')) ); }); }); @@ -128,9 +128,9 @@ describe('MonthDay', () => { }); describe('MonthDay.with()', () => { const md = MonthDay.from('01-15'); - it('throws on bad disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => md.with({ day: 1 }, { disambiguation }), RangeError) + it('throws on bad overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => md.with({ day: 1 }, { overflow }), RangeError) ); }); it('throws on trying to change the calendar', () => { @@ -188,11 +188,11 @@ describe('MonthDay', () => { it("constrains if the MonthDay doesn't exist in the year", () => { const leapDay = MonthDay.from('02-29'); equal(`${leapDay.toDateInYear(2019)}`, '2019-02-28'); - equal(`${leapDay.toDateInYear(2019, { disambiguation: 'constrain' })}`, '2019-02-28'); + equal(`${leapDay.toDateInYear(2019, { overflow: 'constrain' })}`, '2019-02-28'); }); it("can also reject if the MonthDay doesn't exist in the year", () => { const leapDay = MonthDay.from('02-29'); - throws(() => leapDay.toDateInYear(2019, { disambiguation: 'reject' })); + throws(() => leapDay.toDateInYear(2019, { overflow: 'reject' })); }); }); describe('monthDay.getFields() works', () => { diff --git a/polyfill/test/time.mjs b/polyfill/test/time.mjs index d82e44ffa2..67b640b6e1 100644 --- a/polyfill/test/time.mjs +++ b/polyfill/test/time.mjs @@ -187,9 +187,9 @@ describe('Time', () => { it('time.with({ minute: 8, nanosecond: 3 } works', () => { equal(`${time.with({ minute: 8, nanosecond: 3 })}`, '15:08:30.123456003'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => time.with({ hour: 3 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => time.with({ hour: 3 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -329,14 +329,14 @@ describe('Time', () => { equal(`${time.plus({ months: 1 })}`, '15:23:30.123456789'); equal(`${time.plus({ years: 1 })}`, '15:23:30.123456789'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => time.plus({ hours: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => time.plus({ hours: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => time.plus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => time.plus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -375,14 +375,14 @@ describe('Time', () => { equal(`${time.minus({ months: 1 })}`, '15:23:30.123456789'); equal(`${time.minus({ years: 1 })}`, '15:23:30.123456789'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => time.minus({ hours: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => time.minus({ hours: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => time.minus({ hours: 1, minutes: -30 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => time.minus({ hours: 1, minutes: -30 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -433,7 +433,7 @@ describe('Time', () => { it('Time.from({})', () => equal(`${Time.from({})}`, `${new Time()}`)); it('Time.from(ISO string leap second) is constrained', () => { equal(`${Time.from('23:59:60')}`, '23:59:59'); - equal(`${Time.from('23:59:60', { disambiguation: 'reject' })}`, '23:59:59'); + equal(`${Time.from('23:59:60', { overflow: 'reject' })}`, '23:59:59'); }); it('Time.from(number) is converted to string', () => equal(`${Time.from(1523)}`, `${Time.from('1523')}`)); it('Time.from(time) returns the same properties', () => { @@ -499,22 +499,22 @@ describe('Time', () => { ); [{}, () => {}, undefined].forEach((options) => equal(`${Time.from({ hour: 12 }, options)}`, '12:00')); }); - describe('Disambiguation', () => { + describe('Overflow', () => { const bad = { nanosecond: 1000 }; - it('reject', () => throws(() => Time.from(bad, { disambiguation: 'reject' }), RangeError)); + it('reject', () => throws(() => Time.from(bad, { overflow: 'reject' }), RangeError)); it('constrain', () => { equal(`${Time.from(bad)}`, '00:00:00.000000999'); - equal(`${Time.from(bad, { disambiguation: 'constrain' })}`, '00:00:00.000000999'); + equal(`${Time.from(bad, { overflow: 'constrain' })}`, '00:00:00.000000999'); }); - it('throw when bad disambiguation', () => { + it('throw on bad overflow', () => { [new Time(15), { hour: 15 }, '15:00'].forEach((input) => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => Time.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => Time.from(input, { overflow }), RangeError) ); }); }); const leap = { hour: 23, minute: 59, second: 60 }; - it('reject leap second', () => throws(() => Time.from(leap, { disambiguation: 'reject' }), RangeError)); + it('reject leap second', () => throws(() => Time.from(leap, { overflow: 'reject' }), RangeError)); it('constrain leap second', () => equal(`${Time.from(leap)}`, '23:59:59')); }); }); diff --git a/polyfill/test/usercalendar.mjs b/polyfill/test/usercalendar.mjs index b7e5832568..b4427a1ad5 100644 --- a/polyfill/test/usercalendar.mjs +++ b/polyfill/test/usercalendar.mjs @@ -225,13 +225,13 @@ describe('Userland calendar', () => { describe('Trivial protocol implementation', () => { // For the purposes of testing, a nonsensical calendar that has 10-month // years and 10-day months, and the year zero is at the Unix epoch - function decimalToISO(year, month, day, disambiguation) { - if (disambiguation === 'constrain') { + function decimalToISO(year, month, day, overflow) { + if (overflow === 'constrain') { if (month < 1) month = 1; if (month > 10) month = 10; if (day < 1) day = 1; if (day > 10) day = 10; - } else if (disambiguation === 'reject') { + } else if (overflow === 'reject') { if (month < 1 || month > 10 || day < 1 || day > 10) { throw new RangeError('invalid value'); } @@ -251,18 +251,18 @@ describe('Userland calendar', () => { const obj = { id: 'decimal', dateFromFields(fields, options, constructor) { - const { disambiguation = 'constrain' } = options ? options : {}; - const isoDate = decimalToISO(fields.year, fields.month, fields.day, disambiguation); + const { overflow = 'constrain' } = options ? options : {}; + const isoDate = decimalToISO(fields.year, fields.month, fields.day, overflow); return new constructor(isoDate.year, isoDate.month, isoDate.day, this); }, yearMonthFromFields(fields, options, constructor) { - const { disambiguation = 'constrain' } = options ? options : {}; - const isoDate = decimalToISO(fields.year, fields.month, 1, disambiguation); + const { overflow = 'constrain' } = options ? options : {}; + const isoDate = decimalToISO(fields.year, fields.month, 1, overflow); return new constructor(isoDate.year, isoDate.month, this, isoDate.day); }, monthDayFromFields(fields, options, constructor) { - const { disambiguation = 'constrain' } = options ? options : {}; - const isoDate = decimalToISO(0, fields.month, fields.day, disambiguation); + const { overflow = 'constrain' } = options ? options : {}; + const isoDate = decimalToISO(0, fields.month, fields.day, overflow); return new constructor(isoDate.month, isoDate.day, this, isoDate.year); }, year(date) { diff --git a/polyfill/test/yearmonth.mjs b/polyfill/test/yearmonth.mjs index 108e07757a..502fd6a0f4 100644 --- a/polyfill/test/yearmonth.mjs +++ b/polyfill/test/yearmonth.mjs @@ -113,17 +113,17 @@ describe('YearMonth', () => { equal(`${YearMonth.from({ year: 1976, month: 11 }, options)}`, '1976-11') ); }); - describe('Disambiguation', () => { + describe('Overflow', () => { const bad = { year: 2019, month: 13 }; - it('reject', () => throws(() => YearMonth.from(bad, { disambiguation: 'reject' }), RangeError)); + it('reject', () => throws(() => YearMonth.from(bad, { overflow: 'reject' }), RangeError)); it('constrain', () => { equal(`${YearMonth.from(bad)}`, '2019-12'); - equal(`${YearMonth.from(bad, { disambiguation: 'constrain' })}`, '2019-12'); + equal(`${YearMonth.from(bad, { overflow: 'constrain' })}`, '2019-12'); }); - it('throw when bad disambiguation', () => { + it('throw on bad overflow', () => { [new YearMonth(2019, 1), { year: 2019, month: 1 }, '2019-01'].forEach((input) => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => YearMonth.from(input, { disambiguation }), RangeError) + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => YearMonth.from(input, { overflow }), RangeError) ); }); }); @@ -242,13 +242,13 @@ describe('YearMonth', () => { const ym = YearMonth.from('2019-11'); it('(2019-11) plus 2 months === 2020-01', () => { equal(`${ym.plus({ months: 2 })}`, '2020-01'); - equal(`${ym.plus({ months: 2 }, { disambiguation: 'constrain' })}`, '2020-01'); - equal(`${ym.plus({ months: 2 }, { disambiguation: 'reject' })}`, '2020-01'); + equal(`${ym.plus({ months: 2 }, { overflow: 'constrain' })}`, '2020-01'); + equal(`${ym.plus({ months: 2 }, { overflow: 'reject' })}`, '2020-01'); }); it('(2019-11) plus 1 year === 2020-11', () => { equal(`${ym.plus({ years: 1 })}`, '2020-11'); - equal(`${ym.plus({ years: 1 }, { disambiguation: 'constrain' })}`, '2020-11'); - equal(`${ym.plus({ years: 1 }, { disambiguation: 'reject' })}`, '2020-11'); + equal(`${ym.plus({ years: 1 }, { overflow: 'constrain' })}`, '2020-11'); + equal(`${ym.plus({ years: 1 }, { overflow: 'reject' })}`, '2020-11'); }); it('symmetrical with regard to negative durations', () => { equal(`${YearMonth.from('2020-01').plus({ months: -2 })}`, '2019-11'); @@ -289,14 +289,14 @@ describe('YearMonth', () => { equal(`${YearMonth.from('2020-01').plus({ days: 30 })}`, '2020-01'); equal(`${YearMonth.from('2020-01').plus({ days: 31 })}`, '2020-02'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => ym.plus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => ym.plus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => ym.plus({ years: 1, months: -6 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => ym.plus({ years: 1, months: -6 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -310,13 +310,13 @@ describe('YearMonth', () => { const ym = YearMonth.from('2019-11'); it('(2019-11) minus 11 months === 2018-12', () => { equal(`${ym.minus({ months: 11 })}`, '2018-12'); - equal(`${ym.minus({ months: 11 }, { disambiguation: 'constrain' })}`, '2018-12'); - equal(`${ym.minus({ months: 11 }, { disambiguation: 'reject' })}`, '2018-12'); + equal(`${ym.minus({ months: 11 }, { overflow: 'constrain' })}`, '2018-12'); + equal(`${ym.minus({ months: 11 }, { overflow: 'reject' })}`, '2018-12'); }); it('(2019-11) minus 12 years === 2007-11', () => { equal(`${ym.minus({ years: 12 })}`, '2007-11'); - equal(`${ym.minus({ years: 12 }, { disambiguation: 'constrain' })}`, '2007-11'); - equal(`${ym.minus({ years: 12 }, { disambiguation: 'reject' })}`, '2007-11'); + equal(`${ym.minus({ years: 12 }, { overflow: 'constrain' })}`, '2007-11'); + equal(`${ym.minus({ years: 12 }, { overflow: 'reject' })}`, '2007-11'); }); it('symmetrical with regard to negative durations', () => { equal(`${YearMonth.from('2018-12').minus({ months: -11 })}`, '2019-11'); @@ -356,14 +356,14 @@ describe('YearMonth', () => { equal(`${YearMonth.from('2020-01').minus({ days: 30 })}`, '2020-01'); equal(`${YearMonth.from('2020-01').minus({ days: 31 })}`, '2019-12'); }); - it('invalid disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => ym.minus({ months: 1 }, { disambiguation }), RangeError) + it('invalid overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => ym.minus({ months: 1 }, { overflow }), RangeError) ); }); it('mixed positive and negative values always throw', () => { - ['constrain', 'reject'].forEach((disambiguation) => - throws(() => ym.minus({ years: 1, months: -6 }, { disambiguation }), RangeError) + ['constrain', 'reject'].forEach((overflow) => + throws(() => ym.minus({ years: 1, months: -6 }, { overflow }), RangeError) ); }); it('options may only be an object or undefined', () => { @@ -383,18 +383,18 @@ describe('YearMonth', () => { it('constructing from property bag', () => { const tooEarly = { year: -271821, month: 3 }; const tooLate = { year: 275760, month: 10 }; - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { [tooEarly, tooLate].forEach((props) => { - throws(() => YearMonth.from(props, { disambiguation }), RangeError); + throws(() => YearMonth.from(props, { overflow }), RangeError); }); }); equal(`${YearMonth.from({ year: -271821, month: 4 })}`, '-271821-04'); equal(`${YearMonth.from({ year: 275760, month: 9 })}`, '+275760-09'); }); it('constructing from ISO string', () => { - ['reject', 'constrain'].forEach((disambiguation) => { + ['reject', 'constrain'].forEach((overflow) => { ['-271821-03', '+275760-10'].forEach((str) => { - throws(() => YearMonth.from(str, { disambiguation }), RangeError); + throws(() => YearMonth.from(str, { overflow }), RangeError); }); }); equal(`${YearMonth.from('-271821-04')}`, '-271821-04'); @@ -409,16 +409,16 @@ describe('YearMonth', () => { it('adding and subtracting beyond limit', () => { const min = YearMonth.from('-271821-04'); const max = YearMonth.from('+275760-09'); - ['reject', 'constrain'].forEach((disambiguation) => { - throws(() => min.minus({ months: 1 }, { disambiguation }), RangeError); - throws(() => max.plus({ months: 1 }, { disambiguation }), RangeError); + ['reject', 'constrain'].forEach((overflow) => { + throws(() => min.minus({ months: 1 }, { overflow }), RangeError); + throws(() => max.plus({ months: 1 }, { overflow }), RangeError); }); }); }); describe('YearMonth.with()', () => { - it('throws on bad disambiguation', () => { - ['', 'CONSTRAIN', 'balance', 3, null].forEach((disambiguation) => - throws(() => YearMonth.from({ year: 2019, month: 1 }).with({ month: 2 }, { disambiguation }), RangeError) + it('throws on bad overflow', () => { + ['', 'CONSTRAIN', 'balance', 3, null].forEach((overflow) => + throws(() => YearMonth.from({ year: 2019, month: 1 }).with({ month: 2 }, { overflow }), RangeError) ); }); }); diff --git a/spec/abstractops.html b/spec/abstractops.html index 563877baca..de5a169f04 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -41,24 +41,24 @@

GetOption ( _options_, _property_, _type_, _values_, _fallback_ )

- -

ToDurationTemporalDisambiguation ( _options_ )

+ +

ToTemporalDurationOverflow ( _options_ )

1. Set _options_ to ? NormalizeOptionsObject(_options_). - 1. Return ? GetOption(_options_, *"disambiguation"*, *"string"*, « *"constrain"*, *"balance"*, *"reject"* », *"constrain"*). + 1. Return ? GetOption(_options_, *"overflow"*, « *"constrain"*, *"balance"*, *"reject"* », *"constrain"*).
- -

ToTemporalDisambiguation ( _options_ )

+ +

ToTemporalOverflow ( _options_ )

1. Set _options_ to ? NormalizeOptionsObject(_options_). - 1. Return ? GetOption(_options_, *"disambiguation"*, *"string"*, « *"constrain"*, *"reject"* », *"constrain"*). + 1. Return ? GetOption(_options_, *"overflow"*, « *"constrain"*, *"reject"* », *"constrain"*).
- -

ToTimeZoneTemporalDisambiguation ( _options_ )

+ +

ToTemporalDisambiguation ( _options_ )

1. Set _options_ to ? NormalizeOptionsObject(_options_). 1. Return ? GetOption(_options_, *"disambiguation"*, *"string"*, « *"compatible"*, *"earlier"*, *"later"*, *"reject"* », *"compatible"*). diff --git a/spec/date.html b/spec/date.html index b5da80c235..2e04a0eca2 100644 --- a/spec/date.html +++ b/spec/date.html @@ -65,14 +65,14 @@

Temporal.Date.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalDateRecord(_item_). 1. Else, 1. Let _string_ be ? ToString(_item_). 1. Let _result_ be ? ParseTemporalDateString(_string_). 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _disambiguation_). + 1. Set _result_ to ? RegulateDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _overflow_). 1. Return ? CreateTemporalDateFromStatic(_constructor_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]]).
@@ -332,8 +332,8 @@

Temporal.Date.prototype.plus ( _temporalDurationLike_ [ , _options_ ] )

1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. Let _balanceResult_ be ? BalanceDuration(_duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], *"days"*). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). - 1. Let _result_ be ? AddDate(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _disambiguation_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). + 1. Let _result_ be ? AddDate(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _overflow_). 1. Assert: ! ValidateDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*. 1. Return ? CreateTemporalDateFromInstance(_temporalDate_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]]). @@ -351,8 +351,8 @@

Temporal.Date.prototype.minus ( _temporalDurationLike_ [ , _options_ ] )

@@ -368,7 +368,7 @@

Temporal.Date.prototype.with ( _temporalDateLike_ [ , _options_ ] )

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _partialDate_ be ? ToPartialDate(_temporalDateLike_). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If _partialDate_.[[Year]] is not *undefined*, then 1. Let _y_ be _partialDate_.[[Year]]. 1. Else, @@ -381,7 +381,7 @@

Temporal.Date.prototype.with ( _temporalDateLike_ [ , _options_ ] )

1. Let _d_ be _partialDate_.[[Day]]. 1. Else, 1. Let _d_ be _temporalDate_.[[ISODay]]. - 1. Let _result_ be ? RegulateDate(_y_, _m_, _d_, _disambiguation_). + 1. Let _result_ be ? RegulateDate(_y_, _m_, _d_, _overflow_). 1. Assert: ! ValidateDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *true*. 1. Return ? CreateTemporalDateFromInstance(_temporalDate_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]]). @@ -675,19 +675,19 @@

ToPartialDate ( _temporalDateLike_ )

-

RegulateDate ( _year_, _month_, _day_, _disambiguation_ )

+

RegulateDate ( _year_, _month_, _day_, _overflow_ )

- 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. - 1. If _disambiguation_ is *"reject"*, then + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. If _overflow_ is *"reject"*, then 1. Perform ? RejectDate(_year_, _month_, _day_). 1. Return the Record { [[Year]]: _year_, [[Month]]: _month_, [[Day]]: _day_ }. - 1. If _disambiguation_ is *"constrain"*, then + 1. If _overflow_ is *"constrain"*, then 1. Return ! ConstrainDate(_year_, _month_, _day_). - 1. If _disambiguation_ is *"balance"*, then + 1. If _overflow_ is *"balance"*, then 1. Return ? BalanceDate(_year_, _month_, _day_).
@@ -819,31 +819,31 @@

TemporalDateToString ( _temporalDate_ )

-

AddDate ( _year_, _month_, _day_, _years_, _months_, _weeks_, _days_, _disambiguation_ )

+

AddDate ( _year_, _month_, _day_, _years_, _months_, _weeks_, _days_, _overflow_ )

1. Assert: _year_, _month_, _day_, _years_, _months_, _weeks_, and _days_ are integer Number values. - 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. 1. Let _y_ be _year_ + _years_. 1. Let _m_ be _month_ + _months_. 1. Let _intermediate_ be ? BalanceYearMonth(_y_, _m_). - 1. Let _intermediate_ be ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _day_, _disambiguation_). + 1. Let _intermediate_ be ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _day_, _overflow_). 1. Set _days_ to _days_ + 7 × _weeks_. 1. Let _d_ be _intermediate_.[[Day]] + _days_. 1. Let _intermediate_ be ? BalanceDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _d_). - 1. Return ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _disambiguation_). + 1. Return ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _intermediate_.[[Day]], _overflow_).
-

SubtractDate ( _year_, _month_, _day_, _years_, _months_, _days_, _disambiguation_ )

+

SubtractDate ( _year_, _month_, _day_, _years_, _months_, _days_, _overflow_ )

1. Assert: _year_, _month_, _day_, _years_, _months_, and _days_ are integer Number values. - 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. 1. Set _days_ to _days_ + 7 × _weeks_. 1. Let _intermediate_ be ? BalanceDate(_year_, _month_, _day_ - _days_). 1. Let _d_ be _intermediate_.[[Day]]. 1. Let _intermediate_ be ? BalanceYearMonth(_intermediate_.[[Year]] - _years_, _intermediate_.[[Month]] - _months_). - 1. Return ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _d_, _disambiguation_). + 1. Return ? RegulateDate(_intermediate_.[[Year]], _intermediate_.[[Month]], _d_, _overflow_).
diff --git a/spec/datetime.html b/spec/datetime.html index e79a042005..534536fcd9 100644 --- a/spec/datetime.html +++ b/spec/datetime.html @@ -76,14 +76,14 @@

Temporal.DateTime.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalDateTimeRecord(_item_). 1. Else, 1. Let _string_ be ? ToString(_item_). 1. Let _result_ be ? ParseTemporalDateTimeString(_string_). 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _disambiguation_). + 1. Set _result_ to ? RegulateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _overflow_). 1. Return ? CreateTemporalDateTimeFromStatic(_constructor_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]).
@@ -361,7 +361,7 @@

Temporal.DateTime.prototype.with ( _temporalDateTimeLike_ [ , _options_ ] )< 1. Let _dateTime_ be the *this* value. 1. Perform ? RequireInternalSlot(_dateTime_, [[InitializedTemporalDateTime]]). 1. Let _partialDateTime_ be ? ToPartialDateTime(_temporalDateTimeLike_). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If _partialDateTime_.[[Year]] is not *undefined*, then 1. Let _year_ be _partialDateTime_.[[Year]]. 1. Else, @@ -398,7 +398,7 @@

Temporal.DateTime.prototype.with ( _temporalDateTimeLike_ [ , _options_ ] )< 1. Let _nanosecond_ be _partialDateTime_.[[Nanosecond]]. 1. Else, 1. Let _nanosecond_ be _dateTime_.[[Nanosecond]]. - 1. Let _result_ be ? RegulateDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _disambiguation_). + 1. Let _result_ be ? RegulateDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _overflow_). 1. Assert: ! ValidateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*. 1. Return ? CreateTemporalDateTimeFromInstance(_dateTime_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). @@ -415,11 +415,11 @@

Temporal.DateTime.prototype.plus ( _temporalDurationLike_ [ , _options_ ] )< 1. Perform ? RequireInternalSlot(_dateTime_, [[InitializedTemporalDateTime]]). 1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. Let _timePart_ be ? AddTime(_dateTime_.[[Hour]], _dateTime_.[[Minute]], _dateTime_.[[Second]], _dateTime_.[[Millisecond]], _dateTime_.[[Microsecond]], _dateTime_.[[Nanosecond]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). - 1. Let _datePart_ be ? AddDate(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _disambiguation_). + 1. Let _datePart_ be ? AddDate(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _overflow_). 1. Let _datePart_ be ? BalanceDate(_datePart_.[[Year]], _datePart_.[[Month]], _datePart_.[[Day]] + _timePart_.[[Day]]). - 1. Let _result_ be ? RegulateDateTime(_datePart_.[[Year]], _datePart_.[[Month]], _datePart_.[[Day]], _timePart_.[[Hour]], _timePart_.[[Minute]], _timePart_.[[Second]], _timePart_.[[Millisecond]], _timePart_.[[Microsecond]], _timePart_.[[Nanosecond]], _disambiguation_). + 1. Let _result_ be ? RegulateDateTime(_datePart_.[[Year]], _datePart_.[[Month]], _datePart_.[[Day]], _timePart_.[[Hour]], _timePart_.[[Minute]], _timePart_.[[Second]], _timePart_.[[Millisecond]], _timePart_.[[Microsecond]], _timePart_.[[Nanosecond]], _overflow_). 1. Assert: ! ValidateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*. 1. Return ? CreateTemporalDateTimeFromInstance(_dateTime_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). @@ -436,10 +436,10 @@

Temporal.DateTime.prototype.minus ( _temporalDurationLike_ [ , _options_ ] ) 1. Perform ? RequireInternalSlot(_dateTime_, [[InitializedTemporalDateTime]]). 1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. Let _timePart_ be ? SubtractTime(_dateTime_.[[Hour]], _dateTime_.[[Minute]], _dateTime_.[[Second]], _dateTime_.[[Millisecond]], _dateTime_.[[Microsecond]], _dateTime_.[[Nanosecond]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). - 1. Let _datePart_ be ? SubtractDate(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]] - _timePart_.[[Day]], _disambiguation_). - 1. Let _result_ be ? RegulateDateTime(_datePart_.[[Year]], _datePart_.[[Month]], _datePart_.[[Day]], _timePart_.[[Hour]], _timePart_.[[Minute]], _timePart_.[[Second]], _timePart_.[[Millisecond]], _timePart_.[[Microsecond]], _timePart_.[[Nanosecond]], _disambiguation_). + 1. Let _datePart_ be ? SubtractDate(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]] - _timePart_.[[Day]], _overflow_). + 1. Let _result_ be ? RegulateDateTime(_datePart_.[[Year]], _datePart_.[[Month]], _datePart_.[[Day]], _timePart_.[[Hour]], _timePart_.[[Minute]], _timePart_.[[Second]], _timePart_.[[Millisecond]], _timePart_.[[Microsecond]], _timePart_.[[Nanosecond]], _overflow_). 1. Assert: ! ValidateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *true*. 1. Return ? CreateTemporalDateTimeFromInstance(_dateTime_, _result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). @@ -547,7 +547,7 @@

Temporal.DateTime.prototype.toAbsolute ( _temporalTimeZoneLike_ [ , _options 1. Let _dateTime_ be the *this* value. 1. Perform ? RequireInternalSlot(_dateTime_, [[InitializedTemporalDateTime]]). 1. Let _timeZone_ be ? ToTemporalTimeZone(_temporalTimeZoneLike_). - 1. Let _disambiguation_ be ? ToTimeZoneTemporalDisambiguation(_options_). + 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). 1. Return ? GetTemporalAbsoluteFor(_timeZone_, _dateTime_, _disambiguation_). @@ -776,14 +776,14 @@

ToPartialDateTime ( _temporalDateTimeLike_ )

-

RegulateDateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _disambiguation_ )

+

RegulateDateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _overflow_ )

- 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. - 1. If _disambiguation_ is `"constrain"`, then + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. If _overflow_ is *"constrain"*, then 1. Return ! ConstrainDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_). - 1. If _disambiguation_ is `"balance"`, then + 1. If _overflow_ is *"balance"*, then 1. Return ? BalanceDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_). - 1. If _disambiguation_ is `"reject"`, then + 1. If _overflow_ is *"reject"*, then 1. If ! ValidateDateTime(_year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, then 1. Throw a *RangeError* exception. 1. Return the Record { diff --git a/spec/duration.html b/spec/duration.html index 35a51b940d..29cb69e208 100644 --- a/spec/duration.html +++ b/spec/duration.html @@ -88,14 +88,14 @@

Temporal.Duration.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToDurationTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalDurationOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalDurationRecord(_arg_). 1. Else, 1. Let _string_ be ? ToString(_item_). 1. Let _result_ be ? ParseTemporalDurationString(_string_). 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateDuration(_result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]], _disambiguation_). + 1. Set _result_ to ? RegulateDuration(_result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]], _overflow_). 1. Return ? CreateTemporalDurationFromStatic(_constructor_, _result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]). @@ -277,7 +277,7 @@

Temporal.Duration.prototype.with ( _temporalDurationLike_ [ , _options_ ] )< 1. Let _duration_ be the *this* value. 1. Perform ? RequireInternalSlot(_duration_, [[InitializedTemporalDuration]]). 1. Let _temporalDurationLike_ be ? ToPartialDuration(_temporalDurationLike_). - 1. Let _disambiguation_ be ? ToDurationTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalDurationOverflow(_options_). 1. If _temporalDurationLike_.[[Years]] is not *undefined*, then 1. Let _years_ be _temporalDurationLike_.[[Years]]. 1. Else, @@ -318,7 +318,7 @@

Temporal.Duration.prototype.with ( _temporalDurationLike_ [ , _options_ ] )< 1. Let _nanoseconds_ be _temporalDurationLike_.[[Nanoseconds]]. 1. Else, 1. Let _nanoseconds_ be _duration_.[[Nanoseconds]]. - 1. Let _result_ be ? RegulateDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _disambiguation_). + 1. Let _result_ be ? RegulateDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _overflow_). 1. Return ? CreateTemporalDurationFromInstance(_duration_, _result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]). @@ -360,8 +360,8 @@

Temporal.Duration.prototype.plus ( _other_ [ , _options_ ] )

1. Perform ? RequireInternalSlot(_duration_, [[InitializedTemporalDuration]]). 1. Set _other_ to ? ToLimitedTemporalDuration(_other_, « »). 1. Perform ? RejectDurationSign (_other_.[[Years]], _other_.[[Months]], _other_.[[Weeks]], _other_.[[Days]], _other_.[[Hours]], _other_.[[Minutes]], _other_.[[Seconds]], _other_.[[Milliseconds]], _other_.[[Microseconds]], _other_.[[Nanoseconds]]). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). - 1. Let _result_ be ? DurationArithmetic(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _other_.[[Years]], _other_.[[Months]], _other_.[[Weeks]], _other_.[[Days]], _other_.[[Hours]], _other_.[[Minutes]], _other_.[[Seconds]], _other_.[[Milliseconds]], _other_.[[Microseconds]], _other_.[[Nanoseconds]], _disambiguation_). + 1. Let _overflow_ be ? ToTemporalDurationOverflow(_options_). + 1. Let _result_ be ? DurationArithmetic(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _other_.[[Years]], _other_.[[Months]], _other_.[[Weeks]], _other_.[[Days]], _other_.[[Hours]], _other_.[[Minutes]], _other_.[[Seconds]], _other_.[[Milliseconds]], _other_.[[Microseconds]], _other_.[[Nanoseconds]], _overflow_). 1. Return ? CreateTemporalDurationFromInstance(_duration_, _result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]).
@@ -377,8 +377,8 @@

Temporal.Duration.prototype.minus ( _other_ [ , _options_ ] )

1. Perform ? RequireInternalSlot(_duration_, [[InitializedTemporalDuration]]). 1. Set _other_ to ? ToLimitedTemporalDuration(_other_, « »). 1. Perform ? RejectDurationSign (_other_.[[Years]], _other_.[[Months]], _other_.[[Weeks]], _other_.[[Days]], _other_.[[Hours]], _other_.[[Minutes]], _other_.[[Seconds]], _other_.[[Milliseconds]], _other_.[[Microseconds]], _other_.[[Nanoseconds]]). - 1. Let _disambiguation_ be ? ToDurationTemporalDisambiguation(_options_). - 1. Let _result_ be ? DurationArithmetic(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], −_other_.[[Years]], −_other_.[[Months]], −_other_.[[Weeks]], −_other_.[[Days]], −_other_.[[Hours]], −_other_.[[Minutes]], −_other_.[[Seconds]], −_other_.[[Milliseconds]], −_other_.[[Microseconds]], −_other_.[[Nanoseconds]], _disambiguation_). + 1. Let _overflow_ be ? ToTemporalDurationOverflow(_options_). + 1. Let _result_ be ? DurationArithmetic(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], −_other_.[[Years]], −_other_.[[Months]], −_other_.[[Weeks]], −_other_.[[Days]], −_other_.[[Hours]], −_other_.[[Minutes]], −_other_.[[Seconds]], −_other_.[[Milliseconds]], −_other_.[[Microseconds]], −_other_.[[Nanoseconds]], _overflow_). 1. Return ? CreateTemporalDurationFromInstance(_duration_, _result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]). @@ -632,16 +632,16 @@

BalanceDuration ( _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _mi -

RegulateDuration ( _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _disambiguation_ )

+

RegulateDuration ( _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _overflow_ )

- 1. Assert: _disambiguation_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. 1. Perform ? RejectDurationSign(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_). - 1. If _disambiguation_ is *"reject"*, then + 1. If _overflow_ is *"reject"*, then 1. If ! ValidateTemporalDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_) is *false*, then 1. Throw a *RangeError* exception. - 1. Else if _disambiguation_ is *"constrain"*, then + 1. Else if _overflow_ is *"constrain"*, then 1. For each of _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, if any of the values is infinite, let it be the sign of that value times the largest possible finite value of the Number type. - 1. Else if _disambiguation_ is *"balance"*, then + 1. Else if _overflow_ is *"balance"*, then 1. If ! ValidateTemporalDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_) is *false*, then 1. Throw a *RangeError* exception. 1. Let _bd_ be ! BalanceDuration(_days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, *"days"*). @@ -670,10 +670,10 @@

RegulateDuration ( _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _ -

DurationArithmetic ( _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _y2_, _mon2_, _w2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_, _disambiguation_ )

+

DurationArithmetic ( _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _y2_, _mon2_, _w2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_, _overflow_ )

1. Assert: _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _y2_, _mon2_, _w2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_ are integer Number values. - 1. Assert: _disambiguation_ is either *"reject"*, *"balance"*, or *"constrain"*. + 1. Assert: _overflow_ is either *"reject"*, *"balance"*, or *"constrain"*. 1. Let _nanoseconds_ be _ns1_ + _ns2_. 1. Let _microseconds_ be _mus1_ + _mus2_. 1. Let _milliseconds_ be _ms1_ + _ms2_. @@ -725,7 +725,7 @@

DurationArithmetic ( _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _m 1. Set _milliseconds_ to _milliseconds_ × _sign_. 1. Set _microseconds_ to _microseconds_ × _sign_. 1. Set _nanoseconds_ to _nanoseconds_ × _sign_. - 1. Return ? RegulateDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _disambiguation_). + 1. Return ? RegulateDuration(_years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _overflow_). diff --git a/spec/monthday.html b/spec/monthday.html index c5230e1941..3575b0456a 100644 --- a/spec/monthday.html +++ b/spec/monthday.html @@ -65,7 +65,7 @@

Temporal.MonthDay.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalMonthDayRecord(_item_). 1. Let _refISOYear_ be _result_.[[Year]]. @@ -74,7 +74,7 @@

Temporal.MonthDay.from ( _item_ [ , _options_ ] )

1. Let _result_ be ? ParseTemporalMonthDayString(_string_). 1. Let _refISOYear_ be the first leap year after the Unix epoch (1972). 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateMonthDay(_result_.[[Month]], _result_.[[Day]], _disambiguation_). + 1. Set _result_ to ? RegulateMonthDay(_result_.[[Month]], _result_.[[Day]], _overflow_). 1. Return ? CreateTemporalMonthDayFromStatic(_constructor_, _result_.[[Month]], _result_.[[Day]], _refISOYear_).
@@ -142,7 +142,7 @@

Temporal.MonthDay.prototype.with ( _temporalMonthDayLike_ [ , _options_ ] )< 1. Let _monthDay_ be the *this* value. 1. Perform ? RequireInternalSlot(_monthDay_, [[InitializedTemporalMonthDay]]). 1. Let _partialMonthDay_ be ? ToPartialMonthDay(_temporalMonthDayLike_). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If _partialMonthDay_.[[Month]] is not *undefined*, then 1. Let _m_ be _partialMonthDay_.[[Month]]. 1. Else, @@ -151,7 +151,7 @@

Temporal.MonthDay.prototype.with ( _temporalMonthDayLike_ [ , _options_ ] )< 1. Let _d_ be _partialMonthDay_.[[Day]]. 1. Else, 1. Let _d_ be _monthDay_.[[ISODay]]. - 1. Let _result_ be ? RegulateMonthDay(_m_, _d_, _disambiguation_). + 1. Let _result_ be ? RegulateMonthDay(_m_, _d_, _overflow_). 1. Return ? CreateTemporalMonthDayFromInstance(_monthDay_, _result_.[[Month]], _result_.[[Day]]). @@ -232,7 +232,7 @@

Temporal.MonthDay.prototype.toDateInYear ( _item_ [ , _options_ ] )

1. Let _monthDay_ be the *this* value. 1. Perform ? RequireInternalSlot(_monthDay_, [[InitializedTemporalMonthDay]]). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _y_ be ? Get(_item_, *"year"*). 1. If _y_ is *undefined*, then @@ -240,7 +240,7 @@

Temporal.MonthDay.prototype.toDateInYear ( _item_ [ , _options_ ] )

1. Let _y_ be ? ToInteger(_y_). 1. Else, 1. Let _y_ be ? ToInteger(_item_). - 1. Let _date_ be ? RegulateDate(_y_, _monthDay_.[[ISOMonth]], _monthDay_.[[ISODay]], _disambiguation_). + 1. Let _date_ be ? RegulateDate(_y_, _monthDay_.[[ISOMonth]], _monthDay_.[[ISODay]], _overflow_). 1. Return ? CreateTemporalDate(_date_.[[Year]], _date_.[[Month]], _date_.[[Day]]).
@@ -329,18 +329,18 @@

ToPartialMonthDay ( _temporalMonthDayLike_ )

-

RegulateMonthDay ( _month_, _day_, _disambiguation_ )

+

RegulateMonthDay ( _month_, _day_, _overflow_ )

- 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. - 1. If _disambiguation_ is *"reject"*, then + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. If _overflow_ is *"reject"*, then 1. Perform ? RejectMonthDay(_month_, _day_). 1. Return the Record { [[Month]]: _month_, [[Day]]: _day_ }. - 1. If _disambiguation_ is *"constrain"*, then + 1. If _overflow_ is *"constrain"*, then 1. Return ! ConstrainMonthDay(_month_, _day_). - 1. If _disambiguation_ is *"balance"*, then + 1. If _overflow_ is *"balance"*, then 1. Return ! BalanceMonthDay(_month_, _day_).
diff --git a/spec/time.html b/spec/time.html index 377a5be195..4b4b634da8 100644 --- a/spec/time.html +++ b/spec/time.html @@ -70,14 +70,14 @@

Temporal.Time.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalTimeRecord(_item_). 1. Else, 1. Let _string_ be ? ToString(_item_). 1. Let _result_ be ? ParseTemporalTimeString(_string_). 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _disambiguation_). + 1. Set _result_ to ? RegulateTime(_result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _overflow_). 1. Return ? CreateTemporalTimeFromStatic(_constructor_, _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). @@ -211,7 +211,7 @@

Temporal.Time.prototype.plus ( _temporalDurationLike_ [ , _options_ ] )

1. Perform ? RequireInternalSlot(_temporalTime_, [[InitializedTemporalTime]]). 1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). - 1. Perform ? ToTemporalDisambiguation(_options_). + 1. Perform ? ToTemporalOverflow(_options_). 1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. If _sign_ < 0, then 1. Let _result_ be ? SubtractTime(_temporalTime_.[[Hour]], _temporalTime_.[[Minute]], _temporalTime_.[[Second]], _temporalTime_.[[Millisecond]], _temporalTime_.[[Microsecond]], _temporalTime_.[[Nanosecond]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]]). @@ -232,7 +232,7 @@

Temporal.Time.prototype.minus ( _temporalDurationLike_ [ , _options_ ] )

Temporal.Time.prototype.with ( _temporalTimeLike_ [ , _options_ ] ) 1. Let _temporalTime_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalTime_, [[InitializedTemporalTime]]). 1. Let _partialTime_ be ? ToPartialTime(_temporalTimeLike_). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If _partialTime_.[[Hour]] is not *undefined*, then 1. Let _hour_ be _partialTime_.[[Hour]]. 1. Else, @@ -277,7 +277,7 @@

Temporal.Time.prototype.with ( _temporalTimeLike_ [ , _options_ ] )

1. Let _nanosecond_ be _partialTime_.[[Nanosecond]]. 1. Else, 1. Let _nanosecond_ be _temporalTime_.[[Nanosecond]]. - 1. Let _result_ be ? RegulateTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _disambiguation_). + 1. Let _result_ be ? RegulateTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _overflow_). 1. Return ? CreateTemporalTimeFromInstance(_temporalTime_, _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]). @@ -500,14 +500,14 @@

ToPartialTime ( _temporalTimeLike_ )

-

RegulateTime ( _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _disambiguation_ )

+

RegulateTime ( _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _overflow_ )

- 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. - 1. If _disambiguation_ is `"constrain"`, then + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. If _overflow_ is *"constrain"*, then 1. Return ! ConstrainTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_). - 1. If _disambiguation_ is `"balance"`, then + 1. If _overflow_ is *"balance"*, then 1. Return ? BalanceTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_). - 1. If _disambiguation_ is `"reject"`, then + 1. If _overflow_ is *"reject"*, then 1. If ! ValidateTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_) is *false*, then 1. Throw a *RangeError* exception. 1. Return the new Record { diff --git a/spec/timezone.html b/spec/timezone.html index 1e890fcf25..b76e0a4edd 100644 --- a/spec/timezone.html +++ b/spec/timezone.html @@ -208,7 +208,7 @@

Temporal.TimeZone.prototype.getAbsoluteFor ( _dateTime_ [ , _options_ ] )Temporal.YearMonth.from ( _item_ [ , _options_ ] )

The following steps are taken:

- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If Type(_item_) is Object, then 1. Let _result_ be ? ToTemporalYearMonthRecord(_item_). 1. Let _refISODay_ be _result_.[[Day]]. @@ -74,7 +74,7 @@

Temporal.YearMonth.from ( _item_ [ , _options_ ] )

1. Let _result_ be ? ParseTemporalYearMonthString(_string_). 1. Let _refISODay_ be 1. 1. Let _constructor_ be the *this* value. - 1. Set _result_ to ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _disambiguation_). + 1. Set _result_ to ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _overflow_). 1. Return ? CreateTemporalYearMonthFromStatic(_constructor_, _result_.[[Year]], _result_.[[Month]], _refISODay_).
@@ -208,7 +208,7 @@

Temporal.YearMonth.prototype.with ( _temporalYearMonthLike_ [ , _options_ ] 1. Let _yearMonth_ be the *this* value. 1. Perform ? RequireInternalSlot(_yearMonth_, [[InitializedTemporalYearMonth]]). 1. Let _partialYearMonth_ be ? ToPartialYearMonth(_temporalYearMonthLike_). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. If _partialYearMonth_.[[Year]] is not *undefined*, then 1. Let _y_ be _partialYearMonth_.[[Year]]. 1. Else, @@ -217,7 +217,7 @@

Temporal.YearMonth.prototype.with ( _temporalYearMonthLike_ [ , _options_ ] 1. Let _m_ be _partialYearMonth_.[[Month]]. 1. Else, 1. Let _m_ be _yearMonth_.[[ISOMonth]]. - 1. Let _result_ be ? RegulateYearMonth(_y_, _m_, _disambiguation_). + 1. Let _result_ be ? RegulateYearMonth(_y_, _m_, _overflow_). 1. Return ? CreateTemporalYearMonthFromInstance(_yearMonth_, _result_.[[Year]], _result_.[[Month]]). @@ -234,14 +234,14 @@

Temporal.YearMonth.prototype.plus ( _temporalDurationLike_ [ , _options_ ] ) 1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. Let _balanceResult_ be ? BalanceDuration(_duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], *"days"*). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult.[[Days]], 0, 0, 0, 0, 0, 0). 1. If _sign_ < 0, then 1. Let _day_ be ! DaysInMonth(_yearMonth.[[ISOYear]], _yearMonth_.[[ISOMonth]]). 1. Else, 1. Let _day_ be 1. - 1. Let _result_ be ? AddDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _disambiguation_). - 1. Let _result_ be ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _disambiguation_). + 1. Let _result_ be ? AddDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _overflow_). + 1. Let _result_ be ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _overflow_). 1. Return ? CreateTemporalYearMonthFromInstance(_yearMonth_, _result_.[[Year]], _result_.[[Month]]). @@ -258,14 +258,14 @@

Temporal.YearMonth.prototype.minus ( _temporalDurationLike_ [ , _options_ ] 1. Let _duration_ be ? ToLimitedTemporalDuration(_temporalDurationLike_, « »). 1. Perform ? RejectDurationSign(_duration_.[[Years]], _duration.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]]). 1. Let _balanceResult_ be ? BalanceDuration(_duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], *"days"*). - 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_). + 1. Let _overflow_ be ? ToTemporalOverflow(_options_). 1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult.[[Days]], 0, 0, 0, 0, 0, 0). 1. If _sign_ < 0, then 1. Let _day_ be 1. 1. Else, 1. Let _day_ be ! DaysInMonth(_yearMonth.[[ISOYear]], _yearMonth_.[[ISOMonth]]). - 1. Let _result_ be ? SubtractDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _disambiguation_). - 1. Let _result_ be ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _disambiguation_). + 1. Let _result_ be ? SubtractDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], _overflow_). + 1. Let _result_ be ? RegulateYearMonth(_result_.[[Year]], _result_.[[Month]], _overflow_). 1. Return ? CreateTemporalYearMonthFromInstance(_yearMonth_, _result_.[[Year]], _result_.[[Month]]). @@ -458,18 +458,18 @@

ToPartialYearMonth ( _temporalYearMonthLike_ )

-

RegulateYearMonth ( _year_, _month_, _disambiguation_ )

+

RegulateYearMonth ( _year_, _month_, _overflow_ )

1. Assert: _year_ and _month_ are integer Number values. - 1. Assert: _disambiguation_ is one of `"constrain"`, `"balance"`, or `"reject"`. - 1. If _disambiguation_ is `"constrain"`, then + 1. Assert: _overflow_ is one of *"constrain"*, *"balance"*, or *"reject"*. + 1. If _overflow_ is *"constrain"*, then 1. Return ! ConstrainYearMonth(_year_, _month_). - 1. If _disambiguation_ is `"balance"`, then + 1. If _overflow_ is *"balance"*, then 1. Let _result_ be ? BalanceYearMonth(_year_, _month_). 1. If ! ValidateYearMonth(_result_.[[Year]], _result_.[[Month]]) is *false*, then 1. Throw a *RangeError* exception. 1. Return _result_. - 1. If _disambiguation_ is `"reject"`, then + 1. If _overflow_ is *"reject"*, then 1. If ! ValidateYearMonth(_year_, _month_) is *false*, then 1. Throw a *RangeError* exception. 1. Return the new Record {