diff --git a/docs/calendar.md b/docs/calendar.md
index 846897755b..4642500c2a 100644
--- a/docs/calendar.md
+++ b/docs/calendar.md
@@ -97,6 +97,15 @@ Your object must not have a `calendar` property, so that it can be distinguished
The identifier of a custom calendar must consist of one or more components of between 3 and 8 ASCII alphanumeric characters each, separated by dashes, as described in [Unicode Technical Standard 35](https://unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier).
+Custom calendars are responsible for interpreting and validating all inputs, including options.
+Calendars should (and built-in calendars will) throw a TypeError if a required option is missing or has the wrong type, but throw a RangeError if it's present but has an invalid value.
+
+Calendars are also responsible for assigning default values.
+For example, if the `overflow` option is undefined, it will be interpreted by built-in calendars as `'constrain'`.
+Custom calendars should maintain this behavior unless there's a good reason not to.
+Calendars can also accept additional non-default values for existing options or can accept new options that built-in calendars don't.
+When adding new options, calendar authors should use a unique prefix, e.g. the name of the calendar, to avoid potential conflicts with future options which may be used by Temporal.
+
## Constructor
### **new Temporal.Calendar**(_calendarIdentifier_: string) : Temporal.Calendar
@@ -346,12 +355,15 @@ date.toString(); // => 2020-06-28[u-ca-islamic]
If either of `one` or `two` are not `Temporal.PlainDate` objects, then they will be converted to one as if they were passed to `Temporal.PlainDate.from()`.
This method does not need to be called directly except in specialized code.
-It is called indirectly when using the `until()` and `since()` methods of `Temporal.PlainDateTime`, `Temporal.PlainDate`, and `Temporal.PlainYearMonth`.
+It is called indirectly when using the `until()` and `since()` methods of `Temporal.PlainDateTime`, `Temporal.PlainDate`, `Temporal.PlainYearMonth`, and `Temporal.ZonedDateTime`.
If `one` is later than `two`, then the resulting duration should be negative.
The default `largestUnit` value of `'auto'` is the same as `'days'`.
+> **NOTE:** Unlike `Temporal.Calendar.dateAdd()`, the `options` object that this method receives is not always the same object passed to the respective `until()` or `since()` method.
+> Depending on the type, a copy may be made of the object.
+
For example:
```javascript
diff --git a/polyfill/lib/ecmascript.mjs b/polyfill/lib/ecmascript.mjs
index 66c9acffde..f41c75696c 100644
--- a/polyfill/lib/ecmascript.mjs
+++ b/polyfill/lib/ecmascript.mjs
@@ -842,7 +842,7 @@ export const ES = ObjectAssign({}, ES2020, {
millisecond,
microsecond,
nanosecond
- } = ES.InterpretTemporalDateTimeFields(calendar, fields, 'constrain'));
+ } = ES.InterpretTemporalDateTimeFields(calendar, fields, { overflow: 'constrain' }));
offset = relativeTo.offset;
timeZone = relativeTo.timeZone;
} else {
@@ -1077,7 +1077,7 @@ export const ES = ObjectAssign({}, ES2020, {
return ES.ToRecord(bag, entries);
},
- ToTemporalDate: (item, constructor, overflow = 'constrain') => {
+ ToTemporalDate: (item, constructor, options = {}) => {
if (ES.Type(item) === 'Object') {
if (ES.IsTemporalDate(item)) return item;
let calendar = item.calendar;
@@ -1085,8 +1085,9 @@ export const ES = ObjectAssign({}, ES2020, {
calendar = ES.ToTemporalCalendar(calendar);
const fieldNames = ES.CalendarFields(calendar, ['day', 'month', 'year']);
const fields = ES.ToTemporalDateFields(item, fieldNames);
- return ES.DateFromFields(calendar, fields, constructor, overflow);
+ return ES.DateFromFields(calendar, fields, constructor, options);
}
+ ES.ToTemporalOverflow(options); // validate and ignore
let { year, month, day, calendar } = ES.ParseTemporalDateString(ES.ToString(item));
ES.RejectDate(year, month, day);
if (calendar === undefined) calendar = ES.GetISO8601Calendar();
@@ -1095,13 +1096,14 @@ export const ES = ObjectAssign({}, ES2020, {
if (!ES.IsTemporalDate(result)) throw new TypeError('invalid result');
return result;
},
- InterpretTemporalDateTimeFields: (calendar, fields, overflow) => {
+ InterpretTemporalDateTimeFields: (calendar, fields, options) => {
const TemporalDate = GetIntrinsic('%Temporal.PlainDate%');
- const date = ES.DateFromFields(calendar, fields, TemporalDate, overflow);
+ const date = ES.DateFromFields(calendar, fields, TemporalDate, options);
const year = GetSlot(date, ISO_YEAR);
const month = GetSlot(date, ISO_MONTH);
const day = GetSlot(date, ISO_DAY);
let { hour, minute, second, millisecond, microsecond, nanosecond } = ES.ToTemporalTimeRecord(fields);
+ const overflow = ES.ToTemporalOverflow(options);
({ hour, minute, second, millisecond, microsecond, nanosecond } = ES.RegulateTime(
hour,
minute,
@@ -1113,7 +1115,7 @@ export const ES = ObjectAssign({}, ES2020, {
));
return { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond };
},
- ToTemporalDateTime: (item, constructor, overflow = 'constrain') => {
+ ToTemporalDateTime: (item, constructor, options = {}) => {
let year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar;
if (ES.Type(item) === 'Object') {
if (ES.IsTemporalDateTime(item)) return item;
@@ -1134,8 +1136,9 @@ export const ES = ObjectAssign({}, ES2020, {
millisecond,
microsecond,
nanosecond
- } = ES.InterpretTemporalDateTimeFields(calendar, fields, overflow));
+ } = ES.InterpretTemporalDateTimeFields(calendar, fields, options));
} else {
+ ES.ToTemporalOverflow(options); // validate and ignore
({
year,
month,
@@ -1219,7 +1222,7 @@ export const ES = ObjectAssign({}, ES2020, {
if (!ES.IsTemporalInstant(result)) throw new TypeError('invalid result');
return result;
},
- ToTemporalMonthDay: (item, constructor, overflow = 'constrain') => {
+ ToTemporalMonthDay: (item, constructor, options = {}) => {
if (ES.Type(item) === 'Object') {
if (ES.IsTemporalMonthDay(item)) return item;
let calendar = item.calendar;
@@ -1227,9 +1230,10 @@ export const ES = ObjectAssign({}, ES2020, {
calendar = ES.ToTemporalCalendar(calendar);
const fieldNames = ES.CalendarFields(calendar, ['day', 'month']);
const fields = ES.ToTemporalMonthDayFields(item, fieldNames);
- return ES.MonthDayFromFields(calendar, fields, constructor, overflow);
+ return ES.MonthDayFromFields(calendar, fields, constructor, options);
}
+ ES.ToTemporalOverflow(options); // validate and ignore
let { month, day, referenceISOYear = 1972, calendar } = ES.ParseTemporalMonthDayString(ES.ToString(item));
ES.RejectDate(referenceISOYear, month, day);
if (calendar === undefined) calendar = ES.GetISO8601Calendar();
@@ -1273,7 +1277,7 @@ export const ES = ObjectAssign({}, ES2020, {
if (!ES.IsTemporalTime(result)) throw new TypeError('invalid result');
return result;
},
- ToTemporalYearMonth: (item, constructor, overflow = 'constrain') => {
+ ToTemporalYearMonth: (item, constructor, options = {}) => {
if (ES.Type(item) === 'Object') {
if (ES.IsTemporalYearMonth(item)) return item;
let calendar = item.calendar;
@@ -1281,9 +1285,10 @@ export const ES = ObjectAssign({}, ES2020, {
calendar = ES.ToTemporalCalendar(calendar);
const fieldNames = ES.CalendarFields(calendar, ['month', 'year']);
const fields = ES.ToTemporalYearMonthFields(item, fieldNames);
- return ES.YearMonthFromFields(calendar, fields, constructor, overflow);
+ return ES.YearMonthFromFields(calendar, fields, constructor, options);
}
+ ES.ToTemporalOverflow(options); // validate and ignore
let { year, month, referenceISODay = 1, calendar } = ES.ParseTemporalYearMonthString(ES.ToString(item));
ES.RejectDate(year, month, referenceISODay);
if (calendar === undefined) calendar = ES.GetISO8601Calendar();
@@ -1355,13 +1360,7 @@ export const ES = ObjectAssign({}, ES2020, {
const instant = ES.GetTemporalInstantFor(timeZone, dt, disambiguation);
return GetSlot(instant, EPOCHNANOSECONDS);
},
- ToTemporalZonedDateTime: (
- item,
- constructor,
- overflow = 'constrain',
- disambiguation = 'compatible',
- offsetOpt = 'reject'
- ) => {
+ ToTemporalZonedDateTime: (item, constructor, options = {}) => {
let year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, timeZone, offset, calendar;
if (ES.Type(item) === 'Object') {
if (ES.IsTemporalZonedDateTime(item)) return item;
@@ -1380,11 +1379,12 @@ export const ES = ObjectAssign({}, ES2020, {
millisecond,
microsecond,
nanosecond
- } = ES.InterpretTemporalDateTimeFields(calendar, fields, overflow));
+ } = ES.InterpretTemporalDateTimeFields(calendar, fields, options));
timeZone = ES.ToTemporalTimeZone(fields.timeZone);
offset = fields.offset;
if (offset !== undefined) offset = ES.ToString(offset);
} else {
+ ES.ToTemporalOverflow(options); // validate and ignore
let ianaName;
({
year,
@@ -1407,6 +1407,8 @@ export const ES = ObjectAssign({}, ES2020, {
}
let offsetNs = null;
if (offset) offsetNs = ES.ParseOffsetString(offset);
+ const disambiguation = ES.ToTemporalDisambiguation(options);
+ const offsetOpt = ES.ToTemporalOffset(options, 'reject');
const epochNanoseconds = ES.InterpretTemporalZonedDateTimeOffset(
year,
month,
@@ -1482,18 +1484,18 @@ export const ES = ObjectAssign({}, ES2020, {
throw new RangeError('irreconcilable calendars');
}
},
- DateFromFields: (calendar, fields, constructor, overflow = 'constrain') => {
- const result = calendar.dateFromFields(fields, { overflow }, constructor);
+ DateFromFields: (calendar, fields, constructor, options) => {
+ const result = calendar.dateFromFields(fields, options, constructor);
if (!ES.IsTemporalDate(result)) throw new TypeError('invalid result');
return result;
},
- YearMonthFromFields: (calendar, fields, constructor, overflow = 'constrain') => {
- const result = calendar.yearMonthFromFields(fields, { overflow }, constructor);
+ YearMonthFromFields: (calendar, fields, constructor, options) => {
+ const result = calendar.yearMonthFromFields(fields, options, constructor);
if (!ES.IsTemporalYearMonth(result)) throw new TypeError('invalid result');
return result;
},
- MonthDayFromFields: (calendar, fields, constructor, overflow = 'constrain') => {
- const result = calendar.monthDayFromFields(fields, { overflow }, constructor);
+ MonthDayFromFields: (calendar, fields, constructor, options) => {
+ const result = calendar.monthDayFromFields(fields, options, constructor);
if (!ES.IsTemporalMonthDay(result)) throw new TypeError('invalid result');
return result;
},
@@ -2115,7 +2117,7 @@ export const ES = ObjectAssign({}, ES2020, {
calendar,
'days'
);
- let intermediateNs = ES.AddZonedDateTime(start, timeZone, calendar, 0, 0, 0, days, 0, 0, 0, 0, 0, 0, 'constrain');
+ let intermediateNs = ES.AddZonedDateTime(start, timeZone, calendar, 0, 0, 0, days, 0, 0, 0, 0, 0, 0);
// may disambiguate
// If clock time after addition was in the middle of a skipped period, the
@@ -2129,7 +2131,7 @@ export const ES = ObjectAssign({}, ES2020, {
if (sign === 1) {
while (days > 0 && intermediateNs.greater(endNs)) {
--days;
- intermediateNs = ES.AddZonedDateTime(start, timeZone, calendar, 0, 0, 0, days, 0, 0, 0, 0, 0, 0, 'constrain');
+ intermediateNs = ES.AddZonedDateTime(start, timeZone, calendar, 0, 0, 0, days, 0, 0, 0, 0, 0, 0);
// may do disambiguation
}
}
@@ -2139,22 +2141,7 @@ export const ES = ObjectAssign({}, ES2020, {
let relativeInstant = new TemporalInstant(intermediateNs);
do {
// calculate length of the next day (day that contains the time remainder)
- const oneDayFartherNs = ES.AddZonedDateTime(
- relativeInstant,
- timeZone,
- calendar,
- 0,
- 0,
- 0,
- sign,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 'constrain'
- );
+ const oneDayFartherNs = ES.AddZonedDateTime(relativeInstant, timeZone, calendar, 0, 0, 0, sign, 0, 0, 0, 0, 0, 0);
const relativeNs = GetSlot(relativeInstant, EPOCHNANOSECONDS);
dayLengthNs = oneDayFartherNs.subtract(relativeNs).toJSNumber();
isOverflow = nanoseconds.subtract(dayLengthNs).multiply(sign).geq(0);
@@ -2191,8 +2178,7 @@ export const ES = ObjectAssign({}, ES2020, {
seconds,
milliseconds,
microseconds,
- nanoseconds,
- 'constrain'
+ nanoseconds
);
const startNs = GetSlot(relativeTo, EPOCHNANOSECONDS);
nanoseconds = endNs.subtract(startNs);
@@ -2437,7 +2423,7 @@ export const ES = ObjectAssign({}, ES2020, {
const timeZone = GetSlot(relativeTo, TIME_ZONE);
const calendar = GetSlot(relativeTo, CALENDAR);
const offsetBefore = ES.GetOffsetNanosecondsFor(timeZone, instant);
- const after = ES.AddZonedDateTime(instant, timeZone, calendar, y, mon, w, d, h, min, s, ms, µs, ns, 'constrain');
+ const after = ES.AddZonedDateTime(instant, timeZone, calendar, y, mon, w, d, h, min, s, ms, µs, ns);
const TemporalInstant = GetIntrinsic('%Temporal.Instant%');
const instantAfter = new TemporalInstant(after);
const offsetAfter = ES.GetOffsetNanosecondsFor(timeZone, instantAfter);
@@ -2711,7 +2697,8 @@ export const ES = ObjectAssign({}, ES2020, {
µs2,
ns2,
calendar,
- largestUnit
+ largestUnit,
+ options = {}
) => {
const TemporalDate = GetIntrinsic('%Temporal.PlainDate%');
let { deltaDays, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.DifferenceTime(
@@ -2732,7 +2719,8 @@ export const ES = ObjectAssign({}, ES2020, {
const date1 = new TemporalDate(y1, mon1, d1, calendar);
const date2 = new TemporalDate(y2, mon2, d2, calendar);
const dateLargestUnit = ES.LargerOfTwoTemporalDurationUnits('days', largestUnit);
- let { years, months, weeks, days } = calendar.dateUntil(date1, date2, { largestUnit: dateLargestUnit });
+ const untilOptions = { ...options, largestUnit: dateLargestUnit };
+ let { years, months, weeks, days } = calendar.dateUntil(date1, date2, untilOptions);
// Signs of date part and time part may not agree; balance them together
({ days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = ES.BalanceDuration(
days,
@@ -2746,7 +2734,7 @@ export const ES = ObjectAssign({}, ES2020, {
));
return { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds };
},
- DifferenceZonedDateTime: (ns1, ns2, timeZone, calendar, largestUnit) => {
+ DifferenceZonedDateTime: (ns1, ns2, timeZone, calendar, largestUnit, options) => {
const nsDiff = ns2.subtract(ns1);
if (nsDiff.isZero()) {
return {
@@ -2789,24 +2777,11 @@ export const ES = ObjectAssign({}, ES2020, {
GetSlot(dtEnd, ISO_MICROSECOND),
GetSlot(dtEnd, ISO_NANOSECOND),
calendar,
- largestUnit
+ largestUnit,
+ options
);
- let intermediateNs = ES.AddZonedDateTime(
- start,
- timeZone,
- calendar,
- years,
- months,
- weeks,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 'constrain'
- ); // may disambiguate
+ let intermediateNs = ES.AddZonedDateTime(start, timeZone, calendar, years, months, weeks, 0, 0, 0, 0, 0, 0, 0);
+ // may disambiguate
let timeRemainderNs = ns2.subtract(intermediateNs);
const TemporalZonedDateTime = GetIntrinsic('%Temporal.ZonedDateTime%');
const intermediate = new TemporalZonedDateTime(intermediateNs, timeZone, calendar);
@@ -2967,8 +2942,7 @@ export const ES = ObjectAssign({}, ES2020, {
s1,
ms1,
µs1,
- ns1,
- 'constrain'
+ ns1
);
const endNs = ES.AddZonedDateTime(
new TemporalInstant(intermediateNs),
@@ -2983,8 +2957,7 @@ export const ES = ObjectAssign({}, ES2020, {
s2,
ms2,
µs2,
- ns2,
- 'constrain'
+ ns2
);
if (largestUnit !== 'years' && largestUnit !== 'months' && largestUnit !== 'weeks' && largestUnit !== 'days') {
// The user is only asking for a time difference, so return difference of instants.
@@ -3062,7 +3035,7 @@ export const ES = ObjectAssign({}, ES2020, {
milliseconds,
microseconds,
nanoseconds,
- overflow
+ options
) => {
// Add the time part
let deltaDays = 0;
@@ -3087,7 +3060,7 @@ export const ES = ObjectAssign({}, ES2020, {
const TemporalDuration = GetIntrinsic('%Temporal.Duration%');
const datePart = new TemporalDate(year, month, day, calendar);
const dateDuration = new TemporalDuration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);
- const addedDate = calendar.dateAdd(datePart, dateDuration, { overflow }, TemporalDate);
+ const addedDate = calendar.dateAdd(datePart, dateDuration, options, TemporalDate);
return {
year: GetSlot(addedDate, ISO_YEAR),
@@ -3101,7 +3074,7 @@ export const ES = ObjectAssign({}, ES2020, {
nanosecond
};
},
- AddZonedDateTime: (instant, timeZone, calendar, years, months, weeks, days, h, min, s, ms, µs, ns, overflow) => {
+ AddZonedDateTime: (instant, timeZone, calendar, years, months, weeks, days, h, min, s, ms, µs, ns, options) => {
// If only time is to be added, then use Instant math. It's not OK to fall
// through to the date/time code below because compatible disambiguation in
// the PlainDateTime=>Instant conversion will change the offset of any
@@ -3119,7 +3092,7 @@ export const ES = ObjectAssign({}, ES2020, {
let dt = ES.GetTemporalDateTimeFor(timeZone, instant, calendar);
const TemporalDate = GetIntrinsic('%Temporal.PlainDate%');
const datePart = new TemporalDate(GetSlot(dt, ISO_YEAR), GetSlot(dt, ISO_MONTH), GetSlot(dt, ISO_DAY), calendar);
- const addedDate = calendar.dateAdd(datePart, { years, months, weeks, days }, { overflow }, TemporalDate);
+ const addedDate = calendar.dateAdd(datePart, { years, months, weeks, days }, options, TemporalDate);
const TemporalDateTime = GetIntrinsic('%Temporal.PlainDateTime%');
const dtIntermediate = new TemporalDateTime(
GetSlot(addedDate, ISO_YEAR),
@@ -3299,8 +3272,7 @@ export const ES = ObjectAssign({}, ES2020, {
0,
0,
0,
- 0,
- 'constrain'
+ 0
);
const TemporalZonedDateTime = GetIntrinsic('%Temporal.ZonedDateTime%');
return new TemporalZonedDateTime(intermediateNs, timeZone, calendar);
@@ -3367,8 +3339,7 @@ export const ES = ObjectAssign({}, ES2020, {
0,
0,
0,
- 0,
- 'constrain'
+ 0
);
const TemporalInstant = GetIntrinsic('%Temporal.Instant%');
const dayEnd = ES.AddZonedDateTime(
@@ -3384,8 +3355,7 @@ export const ES = ObjectAssign({}, ES2020, {
0,
0,
0,
- 0,
- 'constrain'
+ 0
);
const dayLengthNs = dayEnd.subtract(dayStart);
diff --git a/polyfill/lib/plaindate.mjs b/polyfill/lib/plaindate.mjs
index 56cb379eb5..9c5c8e29e8 100644
--- a/polyfill/lib/plaindate.mjs
+++ b/polyfill/lib/plaindate.mjs
@@ -135,10 +135,9 @@ export class PlainDate {
fields = ES.CalendarMergeFields(calendar, fields, props);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const Construct = ES.SpeciesConstructor(this, PlainDate);
- return ES.DateFromFields(calendar, fields, Construct, overflow);
+ return ES.DateFromFields(calendar, fields, Construct, options);
}
withCalendar(calendar) {
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
@@ -150,7 +149,10 @@ export class PlainDate {
}
add(temporalDurationLike, options = undefined) {
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
+
let duration = ES.ToLimitedTemporalDuration(temporalDurationLike);
+ options = ES.NormalizeOptionsObject(options);
+
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
({ days } = ES.BalanceDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'days'));
@@ -162,7 +164,10 @@ export class PlainDate {
}
subtract(temporalDurationLike, options = undefined) {
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
+
let duration = ES.ToLimitedTemporalDuration(temporalDurationLike);
+ options = ES.NormalizeOptionsObject(options);
+
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
({ days } = ES.BalanceDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'days'));
@@ -192,7 +197,7 @@ export class PlainDate {
const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');
const roundingIncrement = ES.ToTemporalRoundingIncrement(options, undefined, false);
- const result = calendar.dateUntil(this, other, { largestUnit });
+ const result = calendar.dateUntil(this, other, options);
if (smallestUnit === 'days' && roundingIncrement === 1) return result;
let { years, months, weeks, days } = result;
@@ -249,7 +254,7 @@ export class PlainDate {
const roundingMode = ES.ToTemporalRoundingMode(options, 'trunc');
const roundingIncrement = ES.ToTemporalRoundingIncrement(options, undefined, false);
- let { years, months, weeks, days } = calendar.dateUntil(this, other, { largestUnit });
+ let { years, months, weeks, days } = calendar.dateUntil(this, other, options);
const Duration = GetIntrinsic('%Temporal.Duration%');
if (smallestUnit === 'days' && roundingIncrement === 1) {
return new Duration(-years, -months, -weeks, -days, 0, 0, 0, 0, 0, 0);
@@ -414,8 +419,8 @@ export class PlainDate {
}
static from(item, options = undefined) {
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
if (ES.IsTemporalDate(item)) {
+ ES.ToTemporalOverflow(options); // validate and ignore
const year = GetSlot(item, ISO_YEAR);
const month = GetSlot(item, ISO_MONTH);
const day = GetSlot(item, ISO_DAY);
@@ -424,7 +429,7 @@ export class PlainDate {
if (!ES.IsTemporalDate(result)) throw new TypeError('invalid result');
return result;
}
- return ES.ToTemporalDate(item, this, overflow);
+ return ES.ToTemporalDate(item, this, options);
}
static compare(one, two) {
one = ES.ToTemporalDate(one, PlainDate);
diff --git a/polyfill/lib/plaindatetime.mjs b/polyfill/lib/plaindatetime.mjs
index ce13bf964f..e473676a03 100644
--- a/polyfill/lib/plaindatetime.mjs
+++ b/polyfill/lib/plaindatetime.mjs
@@ -205,7 +205,6 @@ export class PlainDateTime {
}
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const calendar = GetSlot(this, CALENDAR);
const fieldNames = ES.CalendarFields(calendar, [
'day',
@@ -234,7 +233,7 @@ export class PlainDateTime {
millisecond,
microsecond,
nanosecond
- } = ES.InterpretTemporalDateTimeFields(calendar, fields, overflow);
+ } = ES.InterpretTemporalDateTimeFields(calendar, fields, options);
const Construct = ES.SpeciesConstructor(this, PlainDateTime);
const result = new Construct(
@@ -317,7 +316,6 @@ export class PlainDateTime {
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const calendar = GetSlot(this, CALENDAR);
const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = ES.AddDateTime(
GetSlot(this, ISO_YEAR),
@@ -340,7 +338,7 @@ export class PlainDateTime {
milliseconds,
microseconds,
nanoseconds,
- overflow
+ options
);
const Construct = ES.SpeciesConstructor(this, PlainDateTime);
const result = new Construct(
@@ -364,7 +362,6 @@ export class PlainDateTime {
let { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const calendar = GetSlot(this, CALENDAR);
const { year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = ES.AddDateTime(
GetSlot(this, ISO_YEAR),
@@ -387,7 +384,7 @@ export class PlainDateTime {
-milliseconds,
-microseconds,
-nanoseconds,
- overflow
+ options
);
const Construct = ES.SpeciesConstructor(this, PlainDateTime);
const result = new Construct(
@@ -454,7 +451,8 @@ export class PlainDateTime {
GetSlot(other, ISO_MICROSECOND),
GetSlot(other, ISO_NANOSECOND),
calendar,
- largestUnit
+ largestUnit,
+ options
);
({
@@ -547,7 +545,8 @@ export class PlainDateTime {
GetSlot(other, ISO_MICROSECOND),
GetSlot(other, ISO_NANOSECOND),
calendar,
- largestUnit
+ largestUnit,
+ options
);
({
@@ -750,8 +749,8 @@ export class PlainDateTime {
static from(item, options = undefined) {
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
if (ES.IsTemporalDateTime(item)) {
+ ES.ToTemporalOverflow(options); // validate and ignore
const year = GetSlot(item, ISO_YEAR);
const month = GetSlot(item, ISO_MONTH);
const day = GetSlot(item, ISO_DAY);
@@ -766,7 +765,7 @@ export class PlainDateTime {
if (!ES.IsTemporalDateTime(result)) throw new TypeError('invalid result');
return result;
}
- return ES.ToTemporalDateTime(item, this, overflow);
+ return ES.ToTemporalDateTime(item, this, options);
}
static compare(one, two) {
one = ES.ToTemporalDateTime(one, PlainDateTime);
diff --git a/polyfill/lib/plainmonthday.mjs b/polyfill/lib/plainmonthday.mjs
index 566e72aa49..1ec78ebfac 100644
--- a/polyfill/lib/plainmonthday.mjs
+++ b/polyfill/lib/plainmonthday.mjs
@@ -90,10 +90,9 @@ export class PlainMonthDay {
fields = ES.CalendarMergeFields(calendar, fields, props);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const Construct = ES.SpeciesConstructor(this, PlainMonthDay);
- const result = ES.MonthDayFromFields(calendar, fields, Construct, overflow);
+ const result = ES.MonthDayFromFields(calendar, fields, Construct, options);
if (!ES.IsTemporalMonthDay(result)) throw new TypeError('invalid result');
return result;
}
@@ -155,8 +154,8 @@ export class PlainMonthDay {
}
static from(item, options = undefined) {
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
if (ES.IsTemporalMonthDay(item)) {
+ ES.ToTemporalOverflow(options); // validate and ignore
const month = GetSlot(item, ISO_MONTH);
const day = GetSlot(item, ISO_DAY);
const calendar = GetSlot(item, CALENDAR);
@@ -165,7 +164,7 @@ export class PlainMonthDay {
if (!ES.IsTemporalMonthDay(result)) throw new TypeError('invalid result');
return result;
}
- return ES.ToTemporalMonthDay(item, this, overflow);
+ return ES.ToTemporalMonthDay(item, this, options);
}
}
diff --git a/polyfill/lib/plainyearmonth.mjs b/polyfill/lib/plainyearmonth.mjs
index d42c9473c1..7c84097966 100644
--- a/polyfill/lib/plainyearmonth.mjs
+++ b/polyfill/lib/plainyearmonth.mjs
@@ -107,10 +107,9 @@ export class PlainYearMonth {
fields = ES.CalendarMergeFields(calendar, fields, props);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const Construct = ES.SpeciesConstructor(this, PlainYearMonth);
- return ES.YearMonthFromFields(calendar, fields, Construct, overflow);
+ return ES.YearMonthFromFields(calendar, fields, Construct, options);
}
add(temporalDurationLike, options = undefined) {
if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');
@@ -120,7 +119,6 @@ export class PlainYearMonth {
({ days } = ES.BalanceDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'days'));
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const TemporalDate = GetIntrinsic('%Temporal.PlainDate%');
const calendar = GetSlot(this, CALENDAR);
@@ -133,7 +131,7 @@ export class PlainYearMonth {
const addedDateFields = ES.ToTemporalYearMonthFields(addedDate, fieldNames);
const Construct = ES.SpeciesConstructor(this, PlainYearMonth);
- return ES.YearMonthFromFields(calendar, addedDateFields, Construct, overflow);
+ return ES.YearMonthFromFields(calendar, addedDateFields, Construct, options);
}
subtract(temporalDurationLike, options = undefined) {
if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');
@@ -155,7 +153,6 @@ export class PlainYearMonth {
({ days } = ES.BalanceDuration(days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds, 'days'));
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const TemporalDate = GetIntrinsic('%Temporal.PlainDate%');
const calendar = GetSlot(this, CALENDAR);
@@ -168,7 +165,7 @@ export class PlainYearMonth {
const addedDateFields = ES.ToTemporalYearMonthFields(addedDate, fieldNames);
const Construct = ES.SpeciesConstructor(this, PlainYearMonth);
- return ES.YearMonthFromFields(calendar, addedDateFields, Construct, overflow);
+ return ES.YearMonthFromFields(calendar, addedDateFields, Construct, options);
}
until(other, options = undefined) {
if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');
@@ -206,7 +203,8 @@ export class PlainYearMonth {
const otherDate = ES.DateFromFields(calendar, { ...otherFields, day: 1 }, TemporalDate);
const thisDate = ES.DateFromFields(calendar, { ...thisFields, day: 1 }, TemporalDate);
- const result = calendar.dateUntil(thisDate, otherDate, { largestUnit });
+ const untilOptions = { ...options, largestUnit };
+ const result = calendar.dateUntil(thisDate, otherDate, untilOptions);
if (smallestUnit === 'months' && roundingIncrement === 1) return result;
let { years, months } = result;
@@ -279,7 +277,8 @@ export class PlainYearMonth {
const otherDate = ES.DateFromFields(calendar, { ...otherFields, day: 1 }, TemporalDate);
const thisDate = ES.DateFromFields(calendar, { ...thisFields, day: 1 }, TemporalDate);
- let { years, months } = calendar.dateUntil(thisDate, otherDate, { largestUnit });
+ const untilOptions = { ...options, largestUnit };
+ let { years, months } = calendar.dateUntil(thisDate, otherDate, untilOptions);
const Duration = GetIntrinsic('%Temporal.Duration%');
if (smallestUnit === 'months' && roundingIncrement === 1) {
return new Duration(-years, -months, 0, 0, 0, 0, 0, 0, 0, 0);
@@ -361,7 +360,7 @@ export class PlainYearMonth {
ObjectAssign(fields, ES.ToRecord(item, entries));
const Date = GetIntrinsic('%Temporal.PlainDate%');
- return ES.DateFromFields(calendar, fields, Date, 'reject');
+ return ES.DateFromFields(calendar, fields, Date, { overflow: 'reject' });
}
getISOFields() {
if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');
@@ -374,8 +373,8 @@ export class PlainYearMonth {
}
static from(item, options = undefined) {
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
if (ES.IsTemporalYearMonth(item)) {
+ ES.ToTemporalOverflow(options); // validate and ignore
const year = GetSlot(item, ISO_YEAR);
const month = GetSlot(item, ISO_MONTH);
const calendar = GetSlot(item, CALENDAR);
@@ -384,7 +383,7 @@ export class PlainYearMonth {
if (!ES.IsTemporalYearMonth(result)) throw new TypeError('invalid result');
return result;
}
- return ES.ToTemporalYearMonth(item, this, overflow);
+ return ES.ToTemporalYearMonth(item, this, options);
}
static compare(one, two) {
one = ES.ToTemporalYearMonth(one, PlainYearMonth);
diff --git a/polyfill/lib/zoneddatetime.mjs b/polyfill/lib/zoneddatetime.mjs
index a573d91167..a0200f324e 100644
--- a/polyfill/lib/zoneddatetime.mjs
+++ b/polyfill/lib/zoneddatetime.mjs
@@ -194,7 +194,6 @@ export class ZonedDateTime {
}
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const disambiguation = ES.ToTemporalDisambiguation(options);
const offset = ES.ToTemporalOffset(options, 'prefer');
@@ -228,7 +227,7 @@ export class ZonedDateTime {
millisecond,
microsecond,
nanosecond
- } = ES.InterpretTemporalDateTimeFields(calendar, fields, overflow);
+ } = ES.InterpretTemporalDateTimeFields(calendar, fields, options);
const offsetNs = ES.ParseOffsetString(fields.offset);
const epochNanoseconds = ES.InterpretTemporalZonedDateTimeOffset(
year,
@@ -345,7 +344,6 @@ export class ZonedDateTime {
const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const timeZone = GetSlot(this, TIME_ZONE);
const calendar = GetSlot(this, CALENDAR);
const epochNanoseconds = ES.AddZonedDateTime(
@@ -362,7 +360,7 @@ export class ZonedDateTime {
milliseconds,
microseconds,
nanoseconds,
- overflow
+ options
);
const Construct = ES.SpeciesConstructor(this, ZonedDateTime);
const result = new Construct(epochNanoseconds, timeZone, calendar);
@@ -375,7 +373,6 @@ export class ZonedDateTime {
const { years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds } = duration;
ES.RejectDurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
const timeZone = GetSlot(this, TIME_ZONE);
const calendar = GetSlot(this, CALENDAR);
const epochNanoseconds = ES.AddZonedDateTime(
@@ -392,7 +389,7 @@ export class ZonedDateTime {
-milliseconds,
-microseconds,
-nanoseconds,
- overflow
+ options
);
const Construct = ES.SpeciesConstructor(this, ZonedDateTime);
const result = new Construct(epochNanoseconds, timeZone, calendar);
@@ -451,6 +448,7 @@ export class ZonedDateTime {
'or smaller because day lengths can vary between time zones due to DST or time zone offset changes.'
);
}
+ const untilOptions = { ...options, largestUnit };
({
years,
months,
@@ -462,7 +460,7 @@ export class ZonedDateTime {
milliseconds,
microseconds,
nanoseconds
- } = ES.DifferenceZonedDateTime(ns1, ns2, timeZone, calendar, largestUnit));
+ } = ES.DifferenceZonedDateTime(ns1, ns2, timeZone, calendar, largestUnit, untilOptions));
({
years,
months,
@@ -575,6 +573,7 @@ export class ZonedDateTime {
'or smaller because day lengths can vary between time zones due to DST or time zone offset changes.'
);
}
+ const untilOptions = { ...options, largestUnit };
({
years,
months,
@@ -586,7 +585,7 @@ export class ZonedDateTime {
milliseconds,
microseconds,
nanoseconds
- } = ES.DifferenceZonedDateTime(ns1, ns2, timeZone, calendar, largestUnit));
+ } = ES.DifferenceZonedDateTime(ns1, ns2, timeZone, calendar, largestUnit, untilOptions));
({
years,
months,
@@ -691,7 +690,7 @@ export class ZonedDateTime {
const calendar = GetSlot(this, CALENDAR);
const dtStart = new DateTime(GetSlot(dt, ISO_YEAR), GetSlot(dt, ISO_MONTH), GetSlot(dt, ISO_DAY), 0, 0, 0, 0, 0, 0);
const instantStart = ES.GetTemporalInstantFor(timeZone, dtStart, 'compatible');
- const endNs = ES.AddZonedDateTime(instantStart, timeZone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 'constrain');
+ const endNs = ES.AddZonedDateTime(instantStart, timeZone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0);
const dayLengthNs = endNs.subtract(GetSlot(instantStart, EPOCHNANOSECONDS));
({ year, month, day, hour, minute, second, millisecond, microsecond, nanosecond } = ES.RoundDateTime(
year,
@@ -836,13 +835,13 @@ export class ZonedDateTime {
}
static from(item, options = undefined) {
options = ES.NormalizeOptionsObject(options);
- const overflow = ES.ToTemporalOverflow(options);
- const disambiguation = ES.ToTemporalDisambiguation(options);
- const offset = ES.ToTemporalOffset(options, 'reject');
if (ES.IsTemporalZonedDateTime(item)) {
+ ES.ToTemporalOverflow(options); // validate and ignore
+ ES.ToTemporalDisambiguation(options);
+ ES.ToTemporalOffset(options, 'reject');
return new ZonedDateTime(GetSlot(item, EPOCHNANOSECONDS), GetSlot(item, TIME_ZONE), GetSlot(item, CALENDAR));
}
- return ES.ToTemporalZonedDateTime(item, this, overflow, disambiguation, offset);
+ return ES.ToTemporalZonedDateTime(item, this, options);
}
static compare(one, two) {
one = ES.ToTemporalZonedDateTime(one, ZonedDateTime);
diff --git a/spec/abstractops.html b/spec/abstractops.html
index b89c385c2d..9d8909d191 100644
--- a/spec/abstractops.html
+++ b/spec/abstractops.html
@@ -571,19 +571,9 @@
ToRelativeTemporalObject ( _options_ )
1. Let _calendar_ be ? GetOptionalTemporalCalendar(_value_).
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"*, *"year"* »).
1. Let _fields_ be ? ToTemporalDateTimeFields(_value_, _fieldNames_).
- 1. Let _temporalDate_ be ? DateFromFields(_calendar_, _fields_, %Temporal.PlainDate%).
- 1. Let _timeResult_ be ? ToTemporalTimeRecord(_fields_).
- 1. Let _result_ be the new Record {
- [[Year]]: _temporalDate_.[[ISOYear]],
- [[Month]]: _temporalDate_.[[ISOMonth]],
- [[Day]]: _temporalDate_.[[ISODay]],
- [[Hour]]: _timeResult_.[[Hour]],
- [[Minute]]: _timeResult_.[[Minute]],
- [[Second]]: _timeResult_.[[Second]],
- [[Millisecond]]: _timeResult_.[[Millisecond]],
- [[Microsecond]]: _timeResult_.[[Microsecond]],
- [[Nanosecond]]: _timeResult_.[[Nanosecond]]
- }.
+ 1. Let _options_ be ! OrdinaryObjectCreate(%Object.prototype%).
+ 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, *"constrain"*).
+ 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _options_).
1. Let _offset_ be ? Get(_value_, *"offset"*).
1. Let _timeZone_ be ? Get(_value_, *"timeZone"*).
1. Else,
@@ -648,6 +638,22 @@ LargerOfTwoTemporalDurationUnits ( _u1_, _u2_ )
+
+ MergeLargestUnitOption ( _options_, _largestUnit_ )
+
+ The abstract operation MergeLargestUnitOption returns a new plain Object with the properties copied from the _options_ Object, and the `largestUnit` property set to _largestUnit_.
+
+
+ 1. Let _merged_ be ! OrdinaryObjectCreate(%Object.prototype%).
+ 1. Let _keys_ be ? EnumerableOwnPropertyNames(_options_, ~key~).
+ 1. For each element _nextKey_ of _keys_, do
+ 1. Let _propValue_ be ? Get(_options_, _nextKey_).
+ 1. Perform ? Set(_merged_, _nextKey_, _propValue_, *true*).
+ 1. Perform ? Set(_merged_, *"largestUnit"*, _largestUnit_, *true*).
+ 1. Return _merged_.
+
+
+
MaximumTemporalDurationRoundingIncrement ( _unit_ )
diff --git a/spec/calendar.html b/spec/calendar.html
index 615555c830..0dd01b8945 100644
--- a/spec/calendar.html
+++ b/spec/calendar.html
@@ -63,15 +63,9 @@ CalendarMergeFields ( _calendar_, _fields_, _additionalFields_ )
- CalendarDateAdd ( _calendar_, _date_, _duration_, _constructor_ [ , _overflow_ ] )
+ CalendarDateAdd ( _calendar_, _date_, _duration_, _constructor_ [ , _options_ ] )
1. Assert: Type(_calendar_) is Object.
- 1. If _overflow_ is *undefined*, then
- 1. Set _overflow_ to *"constrain"*.
- 1. Else,
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
- 1. Let _options_ be ! ObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _dateAdd_ be ? Get(_calendar_, *"dateAdd"*).
1. Let _addedDate_ be ? Call(_dateAdd_, _calendar_, « _date_, _duration_, _options_, _constructor_ »).
1. Perform ? RequireInternalSlot(_addedDate_, [[InitializedTemporalDate]]).
@@ -80,11 +74,9 @@ CalendarDateAdd ( _calendar_, _date_, _duration_, _constructor_ [ , _overflo
- CalendarDateUntil ( _calendar_, _one_, _two_, _largestUnit_ )
+ CalendarDateUntil ( _calendar_, _one_, _two_, _options_ )
1. Assert: Type(_calendar_) is Object.
- 1. Let _options_ be ! ObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"largestUnit"*, _largestUnit_).
1. Let _dateUntil_ be ? Get(_calendar_, *"dateUntil"*).
1. Let _duration_ be ? Call(_dateUntil_ , _calendar_, « _one_, _two_, _options_ »).
1. Perform ? RequireInternalSlot(_duration_, [[InitializedTemporalDuration]]).
@@ -140,16 +132,10 @@ CalendarFrom ( _identifier_ )
- DateFromFields ( _calendar_, _fields_, _constructor_ [ , _overflow_ ] )
+ DateFromFields ( _calendar_, _fields_, _constructor_, _options_ )
1. Assert: Type(_calendar_) is Object.
1. Assert: Type(_fields_) is Object.
- 1. If _overflow_ is *undefined*, then
- 1. Set _overflow_ to *"constrain"*.
- 1. Else,
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
- 1. Let _options_ be ! ObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _dateFromFields_ be ? Get(_calendar_, *"dateFromFields"*).
1. Let _date_ be ? Call(_dateFromFields_, _calendar_, « _fields_, _options_, _constructor_ »).
1. Perform ? RequireInternalSlot(_date_, [[InitializedTemporalDate]]).
@@ -158,16 +144,10 @@ DateFromFields ( _calendar_, _fields_, _constructor_ [ , _overflow_ ] )
- YearMonthFromFields ( _calendar_, _fields_, _constructor_ [ , _overflow_ ] )
+ YearMonthFromFields ( _calendar_, _fields_, _constructor_, _options_ )
1. Assert: Type(_calendar_) is Object.
1. Assert: Type(_fields_) is Object.
- 1. If _overflow_ is *undefined*, then
- 1. Set _overflow_ to *"constrain"*.
- 1. Else,
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
- 1. Let _options_ be ! ObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _yearMonthFromFields_ be ? Get(_calendar_, *"yearMonthFromFields"*).
1. Let _yearMonth_ be ? Call(_yearMonthFromFields_, _calendar_, « _fields_, _options_, _constructor_ »).
1. Perform ? RequireInternalSlot(_yearMonth_, [[InitializedTemporalYearMonth]]).
@@ -176,16 +156,10 @@ YearMonthFromFields ( _calendar_, _fields_, _constructor_ [ , _overflow_ ] )
- MonthDayFromFields ( _calendar_, _fields_, _constructor_ [ , _overflow_ ] )
+ MonthDayFromFields ( _calendar_, _fields_, _constructor_, _options_ )
1. Assert: Type(_calendar_) is Object.
1. Assert: Type(_fields_) is Object.
- 1. If _overflow_ is *undefined*, then
- 1. Set _overflow_ to *"constrain"*.
- 1. Else,
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
- 1. Let _options_ be ! ObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _monthDayFromFields_ be ? Get(_calendar_, *"monthDayFromFields"*).
1. Let _monthDay_ be ? Call(_monthDayFromFields_, _calendar_, « _fields_, _options_, _constructor_ »).
1. Perform ? RequireInternalSlot(_monthDay_, [[InitializedTemporalMonthDay]]).
diff --git a/spec/duration.html b/spec/duration.html
index 9e570f97d2..8ae95eb2da 100644
--- a/spec/duration.html
+++ b/spec/duration.html
@@ -858,7 +858,7 @@ CalculateOffsetShift ( _relativeTo_, _y_, _mon_, _d_, _h_, _min_, _s_, _ms_,
1. If Type(_relativeTo_) is not Object or _relativeTo_ does not have an [[InitializedTemporalZonedDateTime]] internal slot, return 0.
1. Let _instant_ be ? CreateTemporalInstant(_relativeTo_.[[Nanoseconds]]).
1. Let _offsetBefore_ be ? GetOffsetNanosecondsFor(_relativeTo_.[[TimeZone]], _instant_).
- 1. Let _after_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], _y_, _mon_, _d_, _h_, _min_, _s_, _ms_, _mus_, _ns_, *"constrain"*).
+ 1. Let _after_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], _y_, _mon_, _d_, _h_, _min_, _s_, _ms_, _mus_, _ns_).
1. Let _instantAfter_ be ? CreateTemporalInstant(_after_).
1. Let _offsetAfter_ be ? GetOffsetNanosecondsFor(_relativeTo_.[[TimeZone]], _instantAfter_).
1. Return _offsetAfter_ − _offsetBefore_.
@@ -887,7 +887,7 @@ TotalDurationNanoseconds ( _days_, _hours_, _minutes_, _seconds_, _milliseco
BalanceDuration ( _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _largestUnit_ [ , _relativeTo_ ] )
1. If _relativeTo_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
- 1. Let _endNs_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, *"constrain"*).
+ 1. Let _endNs_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_).
1. Set _nanoseconds_ to _endNs_ − _relativeTo_.[[Nanoseconds]].
1. Else,
1. Set _nanoseconds_ to ! TotalDurationNanoseconds(_days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, 0).
@@ -1168,8 +1168,8 @@ AddDuration ( _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _
1. Assert: _relativeTo_ has an [[InitializedTemporalZonedDateTime]] internal slot.
1. Let _timeZone_ be _relativeTo_.[[TimeZone]].
1. Let _calendar_ be _relativeTo_.[[Calendar]].
- 1. Let _intermediateNs_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _timeZone_, _calendar_, _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, *"constrain"*).
- 1. Let _endNs_ be ? AddZonedDateTime(_intermediateNs_, _timeZone_, _calendar_, _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, *"constrain"*).
+ 1. Let _intermediateNs_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _timeZone_, _calendar_, _y1_, _mon1_, _w1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_).
+ 1. Let _endNs_ be ? AddZonedDateTime(_intermediateNs_, _timeZone_, _calendar_, _y2_, _mon2_, _w2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_).
1. If _largestUnit_ is not one of *"years"*, *"months"*, *"weeks"*, or *"days"*, then
1. Let _diffNs_ be ! DifferenceInstant(_relativeTo_.[[Nanoseconds]], _endNs_, 1, *"nanoseconds"*, *"nearest"*).
1. Let _result_ be ! BalanceDuration(0, 0, 0, 0, 0, 0, _diffNs_, _largestUnit_).
@@ -1250,7 +1250,7 @@ MoveRelativeZonedDateTime ( _zonedDateTime_, _years_, _months_, _weeks_, _da
The abstract operation MoveRelativeZonedDateTime adjusts the calendar part of a Temporal.ZonedDateTime instance for use as the "relative-to" parameter of another operation.
- 1. Let _intermediateNs_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[Calendar]], _years_, _months_, _weeks_, _days_, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _intermediateNs_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[Calendar]], _years_, _months_, _weeks_, _days_, 0, 0, 0, 0, 0, 0).
1. Let _intermediate_ be ? CreateTemporalZonedDateTime(_intermediateNs_, _zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[Calendar]]).
@@ -1420,8 +1420,8 @@ AdjustRoundedDurationDays ( _years_, _months_, _weeks_, _days_, _hours_, _mi
}.
1. Let _timeRemainderNs_ be ? TotalDurationNanoseconds(0, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, 0).
1. Let _direction_ be ! Sign(_timeRemainderNs_).
- 1. Let _dayStart_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], _years_, _months_, _weeks_, _days_, 0, 0, 0, 0, 0, 0, *"constrain"*).
- 1. Let _dayEnd_ be ? AddZonedDateTime(_dayStart_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _direction_, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _dayStart_ be ? AddZonedDateTime(_relativeTo_.[[Nanoseconds]], _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], _years_, _months_, _weeks_, _days_, 0, 0, 0, 0, 0, 0).
+ 1. Let _dayEnd_ be ? AddZonedDateTime(_dayStart_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _direction_, 0, 0, 0, 0, 0, 0).
1. Let _dayLengthNs_ be _dayEnd_ − _dayStart_.
1. If (_timeRemainderNs_ − _dayLengthNs_) × _direction_ < 0, then
1. Return the new Record {
diff --git a/spec/plaindate.html b/spec/plaindate.html
index b5b5e80be8..d2e39275ed 100644
--- a/spec/plaindate.html
+++ b/spec/plaindate.html
@@ -68,10 +68,10 @@ Temporal.PlainDate.from ( _item_ [ , _options_ ] )
1. Let _constructor_ be the *this* value.
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalDate]] internal slot, then
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Return ? CreateTemporalDateFromStatic(_constructor_, _item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[ISODay]], _item_.[[Calendar]]).
- 1. Return ? ToTemporalDate(_item_, _constructor_, _overflow_).
+ 1. Return ? ToTemporalDate(_item_, _constructor_, _options_).
@@ -354,12 +354,9 @@ Temporal.PlainDate.prototype.add ( _temporalDurationLike_ [ , _options_ ] )<
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
- 1. Let _dateAddOptions_ be ! OrdinaryObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_dateAddOptions_, *"overflow"*, _overflow_).
1. Let _constructor_ be ? SpeciesConstructor(_temporalDate_, %Temporal.PlainDate%).
1. Let _dateAdd_ be ? Get(_calendar_, *"dateAdd"*).
- 1. Return ? Call(_dateAdd_, _calendar_, « _temporalDate_, _duration_, _dateAddOptions_, _constructor_ »).
+ 1. Return ? Call(_dateAdd_, _calendar_, « _temporalDate_, _duration_, _options_, _constructor_ »).
@@ -376,13 +373,10 @@ Temporal.PlainDate.prototype.subtract ( _temporalDurationLike_ [ , _options_
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _negatedDuration_ be ? CreateTemporalDuration(−_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]]).
- 1. Let _dateAddOptions_ be ! OrdinaryObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_dateAddOptions_, *"overflow"*, _overflow_).
1. Let _constructor_ be ? SpeciesConstructor(_temporalDate_, %Temporal.PlainDate%).
1. Let _dateAdd_ be ? Get(_calendar_, *"dateAdd"*).
- 1. Return ? Call(_dateAdd_, _calendar_, « _temporalDate_, _negatedDuration_, _dateAddOptions_, _constructor_ »).
+ 1. Return ? Call(_dateAdd_, _calendar_, « _temporalDate_, _negatedDuration_, _options_, _constructor_ »).
@@ -407,11 +401,10 @@ Temporal.PlainDate.prototype.with ( _temporalDateLike_ [ , _options_ ] )
@@ -447,7 +440,7 @@ Temporal.PlainDate.prototype.until ( _other_ [ , _options_ ] )
1. Perform ? ValidateTemporalUnitRange(_largestUnit_, _smallestUnit_).
1. Let _roundingMode_ be ? ToTemporalRoundingMode(_options_, *"trunc"*).
1. Let _roundingIncrement_ be ? ToTemporalRoundingIncrement(_options_, *undefined*, *false*).
- 1. Let _result_ be ? CalendarDateUntil(_temporalDate_.[[Calendar]], _temporalDate_, _other_, _largestUnit_).
+ 1. Let _result_ be ? CalendarDateUntil(_temporalDate_.[[Calendar]], _temporalDate_, _other_, _options_).
1. If _smallestUnit_ is not *"days"* or _roundingIncrement_ ≠ 1, then
1. Let _relativeTo_ be ! CreateTemporalDateTime(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], 0, 0, 0, 0, 0, 0, _temporalDate_.[[Calendar]]).
1. Set _result_ to ? RoundDuration(_result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], 0, 0, 0, 0, 0, 0, _roundingIncrement_, _smallestUnit_, _roundingMode_, _relativeTo_).
@@ -474,7 +467,7 @@ Temporal.PlainDate.prototype.since ( _other_ [ , _options_ ] )
1. Let _roundingMode_ be ? ToTemporalRoundingMode(_options_, *"trunc"*).
1. Set _roundingMode_ to ! NegateTemporalRoundingMode(_roundingMode_).
1. Let _roundingIncrement_ be ? ToTemporalRoundingIncrement(_options_, *undefined*, *false*).
- 1. Let _result_ be ? CalendarDateUntil(_temporalDate_.[[Calendar]], _other_, _temporalDate_, _largestUnit_).
+ 1. Let _result_ be ? CalendarDateUntil(_temporalDate_.[[Calendar]], _other_, _temporalDate_, _options_).
1. If _smallestUnit_ is *"days"* and _roundingIncrement_ = 1, then
1. Return ? CreateTemporalDuration(_result_.[[Years]], _result_.[[Months]], _result_.[[Weeks]], _result_.[[Days]], 0, 0, 0, 0, 0, 0).
1. Let _relativeTo_ be ! CreateTemporalDateTime(_temporalDate_.[[ISOYear]], _temporalDate_.[[ISOMonth]], _temporalDate_.[[ISODay]], 0, 0, 0, 0, 0, 0, _temporalDate_.[[Calendar]]).
@@ -715,21 +708,21 @@ CreateTemporalDateFromStatic ( _constructor_, _isoYear_, _isoMonth_, _isoDay
- ToTemporalDate ( _item_ [ , _constructor_ [ , _overflow_ ] ] )
+ ToTemporalDate ( _item_ [ , _constructor_ [ , _options_ ] ] )
The abstract operation ToTemporalDate returns its argument _item_ if it is already a Temporal.PlainDate instance, converts _item_ to a new Temporal.PlainDate instance if possible, and throws otherwise.
1. If _constructor_ is not given, set it to %Temporal.PlainDate%.
- 1. If _overflow_ is not given, set it to *"constrain"*.
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
+ 1. If _options_ is not present, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. If Type(_item_) is Object, then
1. If _item_ has an [[InitializedTemporalDate]] internal slot, then
1. Return _item_.
1. Let _calendar_ be ? GetOptionalTemporalCalendar(_item_).
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"*, *"year"* »).
1. Let _fields_ be ? ToTemporalDateFields(_item_, _fieldNames_).
- 1. Return ? DateFromFields(_calendar_, _fields_, _constructor_, _overflow_).
+ 1. Return ? DateFromFields(_calendar_, _fields_, _constructor_, _options_).
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalDateString(_string_).
1. If ! ValidateDate(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]) is *false*, then
diff --git a/spec/plaindatetime.html b/spec/plaindatetime.html
index 8ad8cdd783..85d76f9c5c 100644
--- a/spec/plaindatetime.html
+++ b/spec/plaindatetime.html
@@ -74,10 +74,10 @@ Temporal.PlainDateTime.from ( _item_ [ , _options_ ] )
1. Let _constructor_ be the *this* value.
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalDateTime]] internal slot, then
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Return ? CreateTemporalDateTimeFromStatic(_constructor_, _item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[ISODay]], _item_.[[ISOHour]], _item_.[[ISOMinute]], _item_.[[ISOSecond]], _item_.[[ISOMillisecond]], _item_.[[ISOMicrosecond]], _item_.[[ISONanosecond]], _item_.[[Calendar]]).
- 1. Return ? ToTemporalDateTime(_item_, _constructor_, _overflow_).
+ 1. Return ? ToTemporalDateTime(_item_, _constructor_, _options_).
@@ -401,10 +401,9 @@ Temporal.PlainDateTime.prototype.with ( _temporalDateTimeLike_ [ , _options_
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"month"*, *"nanosecond"*, *"second"*, *"year"* »).
1. Let _partialDateTime_ be ? ToPartialDateTime(_temporalDateTimeLike_, _fieldNames_).
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _fields_ be ? ToTemporalDateTimeFields(_datetime_, _fieldNames_).
1. Set _fields_ to ? CalendarMergeFields(_calendar_, _fields_, _partialDateTime_).
- 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_).
+ 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _options_).
1. Assert: ! ValidateDateTime(_year_, _month_, _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]], _calendar_).
@@ -467,8 +466,7 @@ Temporal.PlainDateTime.prototype.add ( _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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
- 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _overflow_).
+ 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _options_).
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]], _dateTime_.[[Calendar]]).
@@ -486,8 +484,7 @@ Temporal.PlainDateTime.prototype.subtract ( _temporalDurationLike_ [ , _opti
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
- 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], −_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]], _overflow_).
+ 1. Let _result_ be ? AddDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], −_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]], _options_).
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]], _dateTime_.[[Calendar]]).
@@ -512,7 +509,7 @@ Temporal.PlainDateTime.prototype.until ( _other_ [ , _options_ ] )
1. Let _roundingMode_ be ? ToTemporalRoundingMode(_options_, *"trunc"*).
1. Let _maximum_ be ! MaximumTemporalDurationRoundingIncrement(_smallestUnit_).
1. Let _roundingIncrement_ be ? ToTemporalRoundingIncrement(_options_, _maximum_, *false*).
- 1. Let _diff_ be ? DifferenceDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _dateTime_.[[Calendar]], _largestUnit_).
+ 1. Let _diff_ be ? DifferenceDateTime(_dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _dateTime_.[[Calendar]], _largestUnit_, _options_).
1. Let _roundResult_ be ? RoundDuration(_diff_.[[Years]], _diff_.[[Months]], _diff_.[[Weeks]], _diff_.[[Days]], _diff_.[[Hours]], _diff_.[[Minutes]], _diff_.[[Seconds]], _diff_.[[Milliseconds]], _diff_.[[Microseconds]], _diff_.[[Nanoseconds]], _roundingIncrement_, _smallestUnit_, _roundingMode_, _dateTime_).
1. Let _result_ be ! BalanceDuration(_roundResult_.[[Days]], _roundResult_.[[Hours]], _roundResult_.[[Minutes]], _roundResult_.[[Seconds]], _roundResult_.[[Milliseconds]], _roundResult_.[[Microseconds]], _roundResult_.[[Nanoseconds]], _largestUnit_).
1. Return ? CreateTemporalDuration(_roundResult_.[[Years]], _roundResult_.[[Months]], _roundResult_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]).
@@ -539,7 +536,7 @@ Temporal.PlainDateTime.prototype.since ( _other_ [ , _options_ ] )
1. Set _roundingMode_ to ! NegateTemporalRoundingMode(_roundingMode_).
1. Let _maximum_ be ! MaximumTemporalDurationRoundingIncrement(_smallestUnit_).
1. Let _roundingIncrement_ be ? ToTemporalRoundingIncrement(_options_, _maximum_, *false*).
- 1. Let _diff_ be ? DifferenceDateTime(_other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], _largestUnit_).
+ 1. Let _diff_ be ? DifferenceDateTime(_other_.[[ISOYear]], _other_.[[ISOMonth]], _other_.[[ISODay]], _other_.[[ISOHour]], _other_.[[ISOMinute]], _other_.[[ISOSecond]], _other_.[[ISOMillisecond]], _other_.[[ISOMicrosecond]], _other_.[[ISONanosecond]], _dateTime_.[[ISOYear]], _dateTime_.[[ISOMonth]], _dateTime_.[[ISODay]], _dateTime_.[[ISOHour]], _dateTime_.[[ISOMinute]], _dateTime_.[[ISOSecond]], _dateTime_.[[ISOMillisecond]], _dateTime_.[[ISOMicrosecond]], _dateTime_.[[ISONanosecond]], _dateTime_.[[Calendar]], _largestUnit_, _options_).
1. Let _roundResult_ be ? RoundDuration(−_diff_.[[Years]], −_diff_.[[Months]], −_diff_.[[Weeks]], −_diff_.[[Days]], −_diff_.[[Hours]], −_diff_.[[Minutes]], −_diff_.[[Seconds]], −_diff_.[[Milliseconds]], −_diff_.[[Microseconds]], −_diff_.[[Nanoseconds]], _roundingIncrement_, _smallestUnit_, _roundingMode_, _dateTime_).
1. Let _result_ be ! BalanceDuration(−_roundResult_.[[Days]], −_roundResult_.[[Hours]], −_roundResult_.[[Minutes]], −_roundResult_.[[Seconds]], −_roundResult_.[[Milliseconds]], −_roundResult_.[[Microseconds]], −_roundResult_.[[Nanoseconds]], _largestUnit_).
1. Return ? CreateTemporalDuration(−_roundResult_.[[Years]], −_roundResult_.[[Months]], −_roundResult_.[[Weeks]], _result_.[[Days]], _result_.[[Hours]], _result_.[[Minutes]], _result_.[[Seconds]], _result_.[[Milliseconds]], _result_.[[Microseconds]], _result_.[[Nanoseconds]]).
@@ -887,13 +884,14 @@ DateTimeWithinLimits ( _year_, _month_, _day_, _hour_, _minute_, _second_, _
- InterpretTemporalDateTimeFields ( _calendar_, _fields_, _overflow_ )
+ InterpretTemporalDateTimeFields ( _calendar_, _fields_, _options_ )
The abstract operation InterpretTemporalDateTimeFields interprets the date/time fields in the object _fields_ using the given _calendar_, and returns a Record with the fields according to the ISO calendar.
- 1. Let _temporalDate_ be ? DateFromFields(_calendar_, _fields_, %Temporal.PlainDate%, _overflow_).
+ 1. Let _temporalDate_ be ? DateFromFields(_calendar_, _fields_, %Temporal.PlainDate%, _options_).
1. Let _timeResult_ be ? ToTemporalTimeRecord(_fields_).
+ 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _timeResult_ be ? RegulateTime(_timeResult_.[[Hour]], _timeResult_.[[Minute]], _timeResult_.[[Second]], _timeResult_.[[Millisecond]], _timeResult_.[[Microsecond]], _timeResult_.[[Nanosecond]], _overflow_).
1. Return the new Record {
[[Year]]: _temporalDate_.[[ISOYear]],
@@ -910,22 +908,22 @@ InterpretTemporalDateTimeFields ( _calendar_, _fields_, _overflow_ )
- ToTemporalDateTime ( _item_ [ , _constructor_ [ , _overflow_ ] ] )
+ ToTemporalDateTime ( _item_ [ , _constructor_ [ , _options_ ] ] )
The abstract operation ToTemporalDateTime returns its argument _item_ if it is already a Temporal.PlainDateTime instance, converts _item_ to a new Temporal.PlainDateTime instance if possible, and throws otherwise.
1. If _constructor_ is not given, set it to %Temporal.PlainDateTime%.
- 1. If _overflow_ is not given, set it to *"constrain"*.
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
+ 1. If _options_ is not given, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. If Type(_item_) is Object, then
1. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then
1. Return _item_.
1. Let _calendar_ be ? GetOptionalTemporalCalendar(_item_).
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"month"*, *"nanosecond"*, *"second"*, *"year"* »).
1. Let _fields_ be ? ToTemporalDateTimeFields(_item_, _fieldNames_).
- 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_).
+ 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _options_).
1. Else,
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalDateTimeString(_string_).
1. If ! ValidateDateTime(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]]) is *false*, then
@@ -1151,13 +1149,11 @@ CompareTemporalDateTime ( _y1_, _mon1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mu
- AddDateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _calendar_, _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _overflow_ )
+ AddDateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _calendar_, _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _options_ )
The abstract operation AddDateTime adds a duration to a combined date and time, according to the reckoning of the given _calendar_.
- 1. Let _options_ be ! OrdinaryObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _timeResult_ be ? AddTime(_hour_, _minute_, _second_, _millisecond_, _microsecond_, _nanosecond_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_).
1. Let _datePart_ be ? CreateTemporalDate(_year_, _month_, _day_, _calendar_).
1. Let _dateDuration_ be ? CreateTemporalDuration(_years_, _months_, _weeks_, _days_ + _timeResult_.[[Days]]).
@@ -1200,22 +1196,22 @@ RoundDateTime ( _year_, _month_, _day_, _hour_, _minute_, _second_, _millise
- DifferenceDateTime ( _y1_, _mon1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _y2_, _mon2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_, _calendar_, _largestUnit_ )
+ DifferenceDateTime ( _y1_, _mon1_, _d1_, _h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _y2_, _mon2_, _d2_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_, _calendar_, _largestUnit_ [ , _options_ ] )
The abstract operation DifferenceDateTime returns a Record with the elapsed duration from a first date and time, until a second date and time, according to the reckoning of the given _calendar_.
The given date and time units are all in the ISO 8601 calendar.
- The _largestUnit_ argument is used in _calendar_'s `dateUntil` method.
+ The _largestUnit_ and _options_ arguments are used in _calendar_'s `dateUntil` method.
+ 1. If _options_ is not given, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. Let _timeDifference_ be ? DifferenceTime(_h1_, _min1_, _s1_, _ms1_, _mus1_, _ns1_, _h2_, _min2_, _s2_, _ms2_, _mus2_, _ns2_).
1. Let _balanceResult_ be ? BalanceDate(_y1_, _mon1_, _d1_ + _timeDifference_.[[Days]]).
1. Let _date1_ be ? CreateTemporalDate(_balanceResult_.[[Year]], _balanceResult_.[[Month]], _balanceResult_.[[Day]]).
1. Let _date2_ be ? CreateTemporalDate(_y2_, _mon2_, _d2_).
1. Let _dateUntil_ be ? Get(_calendar_, *"dateUntil"*).
1. Let _dateLargestUnit_ be ! LargerOfTwoTemporalUnits(*"days"*, _largestUnit_).
- 1. Let _options_ be ! OrdinaryObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"largestUnit"*, _dateLargestUnit_).
- 1. Let _dateDifference_ be ? Call(_dateUntil_, _calendar_, « _date1_, _date2_, _options_ »).
+ 1. Let _untilOptions_ be ? MergeLargestUnitOption(_options_, _dateLargestUnit_).
+ 1. Let _dateDifference_ be ? Call(_dateUntil_, _calendar_, « _date1_, _date2_, _untilOptions_ »).
1. Return ? BalanceDuration(_dateDifference_.[[Years]], _dateDifference_.[[Months]], _dateDifference_.[[Weeks]], _dateDifference_.[[Days]], _timeDifference_.[[Hours]], _timeDifference_.[[Minutes]], _timeDifference_.[[Seconds]], _timeDifference_.[[Milliseconds]], _timeDifference_.[[Microseconds]], _timeDifference_.[[Nanoseconds]], _largestUnit_).
diff --git a/spec/plainmonthday.html b/spec/plainmonthday.html
index 78e78baaa2..267913a178 100644
--- a/spec/plainmonthday.html
+++ b/spec/plainmonthday.html
@@ -70,10 +70,10 @@ Temporal.PlainMonthDay.from ( _item_ [ , _options_ ] )
1. Let _constructor_ be the *this* value.
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalMonthDay]] internal slot, then
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Return ? CreateTemporalMonthDayFromStatic(_constructor_, _item_.[[ISOMonth]], _item_.[[ISODay]], _item_.[[ISOYear]], _item_.[[Calendar]]).
- 1. Return ? ToTemporalMonthDay(_item_, _constructor_, _overflow_).
+ 1. Return ? ToTemporalMonthDay(_item_, _constructor_, _options_).
@@ -168,11 +168,10 @@ Temporal.PlainMonthDay.prototype.with ( _temporalMonthDayLike_ [ , _options_
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"* »).
1. Let _partialMonthDay_ be ? ToPartialMonthDay(_temporalMonthDayLike_, _fieldNames_).
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _fields_ be ? ToTemporalMonthDayFields(_monthDay_, _fieldNames_).
1. Set _fields_ to ? CalendarMergeFields(_calendar_, _fields_, _partialMonthDay_).
1. Let _constructor_ be ? SpeciesConstructor(_monthDay_, %Temporal.PlainMonthDay%).
- 1. Return ? MonthDayFromFields(_calendar_, _fields_, _constructor_, _overflow_).
+ 1. Return ? MonthDayFromFields(_calendar_, _fields_, _constructor_, _options_).
@@ -356,21 +355,21 @@ Properties of Temporal.PlainMonthDay Instances
Abstract operations
- ToTemporalMonthDay ( _item_ [ , _constructor_ [ , _overflow_ ] ] )
+ ToTemporalMonthDay ( _item_ [ , _constructor_ [ , _options_ ] ] )
The abstract operation ToTemporalMonthDay returns its argument _item_ if it is already a Temporal.PlainMonthDay instance, converts _item_ to a new Temporal.PlainMonthDay instance if possible, and throws otherwise.
1. If _constructor_ is not given, set it to %Temporal.PlainMonthDay%.
- 1. If _overflow_ is not given, set it to *"constrain"*.
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
+ 1. If _options_ is not given, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. If Type(_item_) is Object, then
1. If _item_ has an [[InitializedTemporalMonthDay]] internal slot, then
1. Return _item_.
1. Let _calendar_ be ? GetOptionalTemporalCalendar(_item_).
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"* »).
1. Let _fields_ be ? ToTemporalMonthDayFields(_item_, _fieldNames_).
- 1. Return ? MonthDayFromFields(_calendar_, _fields_, _overflow_, _constructor_).
+ 1. Return ? MonthDayFromFields(_calendar_, _fields_, _constructor_, _options_).
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalMonthDayString(_string_).
1. If _result_.[[Year]] is *undefined*, then
diff --git a/spec/plainyearmonth.html b/spec/plainyearmonth.html
index 04c870ba91..347808a864 100644
--- a/spec/plainyearmonth.html
+++ b/spec/plainyearmonth.html
@@ -69,10 +69,10 @@ Temporal.PlainYearMonth.from ( _item_ [ , _options_ ] )
1. Let _constructor_ be the *this* value.
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalYearMonth]] internal slot, then
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Return ? CreateTemporalYearMonthFromStatic(_constructor_, _item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[Calendar]], _item_.[[ISODay]]).
- 1. Return ? ToTemporalYearMonth(_item_, _constructor_, _overflow_).
+ 1. Return ? ToTemporalYearMonth(_item_, _constructor_, _options_).
@@ -241,11 +241,10 @@ Temporal.PlainYearMonth.prototype.with ( _temporalYearMonthLike_ [ , _option
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"month"*, *"year"* »).
1. Let _partialYearMonth_ be ? ToPartialYearMonth(_temporalYearMonthLike_, _fieldNames_).
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _fields_ be ? ToTemporalYearMonthFields(_yearMonth_, _fieldNames_).
1. Set _fields_ to ? CalendarMergeFields(_calendar_, _fields_, _partialYearMonth_).
1. Let _constructor_ be ? SpeciesConstructor(_yearMonth_, %Temporal.PlainYearMonth%).
- 1. Return ? YearMonthFromFields(_calendar_, _fields_, _constructor_, _overflow_).
+ 1. Return ? YearMonthFromFields(_calendar_, _fields_, _constructor_, _options_).
@@ -262,7 +261,6 @@ Temporal.PlainYearMonth.prototype.add ( _temporalDurationLike_ [ , _options_
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _calendar_ be _yearMonth_.[[Calendar]].
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"month"*, *"year"* »).
1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0).
@@ -273,10 +271,10 @@ Temporal.PlainYearMonth.prototype.add ( _temporalDurationLike_ [ , _options_
1. Let _day_ be 1.
1. Let _date_ be ? CreateTemporalDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _calendar_).
1. Let _durationToAdd_ be ? CreateTemporalDuration(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0).
- 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, %Temporal.PlainDate%, _overflow_).
+ 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, %Temporal.PlainDate%, _options_).
1. Let _addedDateFields_ be ToTemporalYearMonthFields(_addedDate_, _fieldNames_).
1. Let _constructor_ be ? SpeciesConstructor(_yearMonth_, %Temporal.PlainYearMonth%).
- 1. Return ? YearMonthFromFields(_calendar_, _addedDateFields_, _constructor_, _overflow_).
+ 1. Return ? YearMonthFromFields(_calendar_, _addedDateFields_, _constructor_, _options_).
@@ -293,7 +291,6 @@ Temporal.PlainYearMonth.prototype.subtract ( _temporalDurationLike_ [ , _opt
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _calendar_ be _yearMonth_.[[Calendar]].
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"month"*, *"year"* »).
1. Let _sign_ be ! DurationSign(_duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0).
@@ -304,10 +301,10 @@ Temporal.PlainYearMonth.prototype.subtract ( _temporalDurationLike_ [ , _opt
1. Let _day_ be 1.
1. Let _date_ be ? CreateTemporalDate(_yearMonth_.[[ISOYear]], _yearMonth_.[[ISOMonth]], _day_, _calendar_).
1. Let _durationToAdd_ be ? CreateTemporalDuration(−_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_balanceResult_.[[Days]], 0, 0, 0, 0, 0, 0).
- 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, %Temporal.PlainDate%, _overflow_).
+ 1. Let _addedDate_ be ? CalendarDateAdd(_calendar_, _date_, _durationToAdd_, %Temporal.PlainDate%, _options_).
1. Let _addedDateFields_ be ToTemporalYearMonthFields(_addedDate_, _fieldNames_).
1. Let _constructor_ be ? SpeciesConstructor(_yearMonth_, %Temporal.PlainYearMonth%).
- 1. Return ? YearMonthFromFields(_calendar_, _addedDateFields_, _constructor_, _overflow_).
+ 1. Return ? YearMonthFromFields(_calendar_, _addedDateFields_, _constructor_, _options_).
@@ -337,7 +334,8 @@ Temporal.PlainYearMonth.prototype.until ( _other_ [ , _options_ ] )
1. Let _thisFields_ be ToTemporalYearMonthFields(_yearMonth_, _fieldNames_).
1. Perform ! CreateDataPropertyOrThrow(_thisFields_, *"day"*, *1*𝔽).
1. Let _thisDate_ be ? DateFromFields(_calendar_, _thisFields_, %Temporal.PlainDate%).
- 1. Let _result_ be ? CalendarDateUntil(_calendar_, _thisDate_, _otherDate_, _largestUnit_).
+ 1. Let _untilOptions_ be ? MergeLargestUnitOption(_options_, _largestUnit_).
+ 1. Let _result_ be ? CalendarDateUntil(_calendar_, _thisDate_, _otherDate_, _untilOptions_).
1. If _smallestUnit_ is *"months"* and _roundingIncrement_ = 1, then
1. Return ? CreateTemporalDuration(_result_.[[Years]], _result_.[[Months]], 0, 0, 0, 0, 0, 0, 0).
1. Let _relativeTo_ be ? CreateTemporalDateTime(_thisDate_.[[ISOYear]], _thisDate_.[[ISOMonth]], _thisDate_.[[ISODay]], 0, 0, 0, 0, 0, 0, _calendar_).
@@ -373,7 +371,8 @@ Temporal.PlainYearMonth.prototype.since ( _other_ [ , _options_ ] )
1. Let _thisFields_ be ToTemporalYearMonthFields(_yearMonth_, _fieldNames_).
1. Perform ! CreateDataPropertyOrThrow(_thisFields_, *"day"*, *1*𝔽).
1. Let _thisDate_ be ? DateFromFields(_calendar_, _thisFields_, %Temporal.PlainDate%).
- 1. Let _result_ be ? CalendarDateUntil(_calendar_, _thisDate_, _otherDate_, _largestUnit_).
+ 1. Let _untilOptions_ be ? MergeLargestUnitOption(_options_, _largestUnit_).
+ 1. Let _result_ be ? CalendarDateUntil(_calendar_, _thisDate_, _otherDate_, _untilOptions_).
1. If _smallestUnit_ is *"months"* and _roundingIncrement_ = 1, then
1. Return ? CreateTemporalDuration(−_result_.[[Years]], −_result_.[[Months]], 0, 0, 0, 0, 0, 0, 0).
1. Let _relativeTo_ be ? CreateTemporalDateTime(_thisDate_.[[ISOYear]], _thisDate_.[[ISOMonth]], _thisDate_.[[ISODay]], 0, 0, 0, 0, 0, 0, _calendar_).
@@ -474,7 +473,9 @@ Temporal.PlainYearMonth.prototype.toPlainDate ( _item_ )
1. Throw a *TypeError* exception.
1. Let _value_ be ? ToIntegerOrInfinity(_value_).
1. Perform ! CreateDataPropertyOrThrow(_fields_, _property_, _value_).
- 1. Return ? DateFromFields(_calendar_, _fields_, *"reject"*, %Temporal.PlainDate%).
+ 1. Let _options_ be ! OrdinaryObjectCreate(%Object.prototype%).
+ 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, *"reject"*).
+ 1. Return ? DateFromFields(_calendar_, _fields_, _options_, %Temporal.PlainDate%).
@@ -563,21 +564,21 @@ Properties of Temporal.PlainYearMonth Instances
Abstract operations
- ToTemporalYearMonth ( _item_ [ , _constructor_ [ , _overflow_ ] ] )
+ ToTemporalYearMonth ( _item_ [ , _constructor_ [ , _options_ ] ] )
The abstract operation ToTemporalYearMonth returns its argument _item_ if it is already a Temporal.PlainYearMonth instance, converts _item_ to a new Temporal.PlainYearMonth instance if possible, and throws otherwise.
1. If _constructor_ is not given, set it to %Temporal.PlainYearMonth%.
- 1. If _overflow_ is not given, set it to *"constrain"*.
- 1. Assert: _overflow_ is one of *"constrain"* or *"reject"*.
+ 1. If _options_ is not given, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. If Type(_item_) is Object, then
1. If _item_ has an [[InitializedTemporalYearMonth]] internal slot, then
1. Return _item_.
1. Let _calendar_ be ? GetOptionalTemporalCalendar(_item_).
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"month"*, *"year"* »).
1. Let _fields_ be ? ToTemporalYearMonthFields(_item_, _fieldNames_).
- 1. Return ? YearMonthFromFields(_calendar_, _fields_, _overflow_, _constructor_).
+ 1. Return ? YearMonthFromFields(_calendar_, _fields_, _constructor_, _options_).
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalYearMonthString(_string_).
1. If _result_.[[Day]] is *undefined*, then
diff --git a/spec/zoneddatetime.html b/spec/zoneddatetime.html
index c07883bb1b..db5f58f8af 100644
--- a/spec/zoneddatetime.html
+++ b/spec/zoneddatetime.html
@@ -69,12 +69,12 @@ Temporal.ZonedDateTime.from ( _item_ [ , _options_ ] )
1. Let _constructor_ be the *this* value.
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
- 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_).
- 1. Let _offset_ be ? ToTemporalOffset(_options_).
1. If Type(_item_) is Object and _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
+ 1. Perform ? ToTemporalOverflow(_options_).
+ 1. Perform ? ToTemporalDisambiguation(_options_).
+ 1. Perform ? ToTemporalOffset(_options_, *"reject"*).
1. Return ? CreateTemporalZonedDateTimeFromStatic(_constructor_, _item_.[[Nanoseconds]], _item_.[[TimeZone]], _item_.[[Calendar]]).
- 1. Return ? ToTemporalZonedDateTime(_item_, _constructor_, _overflow_, _disambiguation_, _offset_).
+ 1. Return ? ToTemporalZonedDateTime(_item_, _constructor_, _options_).
@@ -578,7 +578,6 @@ Temporal.ZonedDateTime.prototype.with ( _temporalZonedDateTimeLike_ [ , _opt
1. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"month"*, *"nanosecond"*, *"second"*, *"year"* »).
1. Let _partialZonedDateTime_ be ? ToPartialZonedDateTime(_temporalZonedDateTimeLike_, _fieldNames_).
1. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_).
1. Let _offset_ be ? ToTemporalOffset(_options_, *"prefer"*).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
@@ -589,7 +588,7 @@ Temporal.ZonedDateTime.prototype.with ( _temporalZonedDateTimeLike_ [ , _opt
1. Perform ? Set(_fields_, *"offset"*, _offsetString_).
1. Else,
1. Set _offsetString_ to ? Get(_fields_, *"offset"*).
- 1. Let _dateTimeResult_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_).
+ 1. Let _dateTimeResult_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _options_).
1. Let _offsetNanoseconds_ be ? ParseTimeZoneOffsetString(_offsetString_).
1. Let _epochNanoseconds_ be ? InterpretTemporalZonedDateTimeOffset(_dateTimeResult_.[[Year]], _dateTimeResult_.[[Month]], _dateTimeResult_.[[Day]], _dateTimeResult_.[[Hour]], _dateTimeResult_.[[Minute]], _dateTimeResult_.[[Second]], _dateTimeResult_.[[Millisecond]], _dateTimeResult_.[[Microsecond]], _dateTimeResult_.[[Nanosecond]], _offsetNanoseconds_, _timeZone_, _disambiguation_, _offset_).
1. Return ? CreateTemporalZonedDateTimeFromInstance(_zonedDateTime_, _epochNanoseconds_, _timeZone_, _calendar_).
@@ -679,10 +678,9 @@ Temporal.ZonedDateTime.prototype.add ( _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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
- 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZone_, _calendar_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _overflow_).
+ 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZone_, _calendar_, _duration_.[[Years]], _duration_.[[Months]], _duration_.[[Weeks]], _duration_.[[Days]], _duration_.[[Hours]], _duration_.[[Minutes]], _duration_.[[Seconds]], _duration_.[[Milliseconds]], _duration_.[[Microseconds]], _duration_.[[Nanoseconds]], _options_).
1. Return ? CreateTemporalZonedDateTimeFromInstance(_zonedDateTime_, _epochNanoseconds_, _timeZone_, _calendar_).
@@ -699,10 +697,9 @@ Temporal.ZonedDateTime.prototype.subtract ( _temporalDurationLike_ [ , _opti
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. Set _options_ to ? NormalizeOptionsObject(_options_).
- 1. Let _overflow_ be ? ToTemporalOverflow(_options_).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
- 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZone_, _calendar_, −_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]], _overflow_).
+ 1. Let _epochNanoseconds_ be ? AddZonedDateTime(_zonedDateTime_.[[Nanoseconds]], _timeZone_, _calendar_, −_duration_.[[Years]], −_duration_.[[Months]], −_duration_.[[Weeks]], −_duration_.[[Days]], −_duration_.[[Hours]], −_duration_.[[Minutes]], −_duration_.[[Seconds]], −_duration_.[[Milliseconds]], −_duration_.[[Microseconds]], −_duration_.[[Nanoseconds]], _options_).
1. Return ? CreateTemporalZonedDateTimeFromInstance(_zonedDateTime_, _epochNanoseconds_, _timeZone_, _calendar_).
@@ -796,7 +793,7 @@ Temporal.ZonedDateTime.prototype.round ( _options_ )
1. Let _dtStart_ be ? CreateTemporalDateTime(_temporalDateTime_.[[ISOYear]], _temporalDateTime_.[[ISOMonth]], _temporalDateTime_.[[ISODay]], 0, 0, 0, 0, 0, 0, _isoCalendar_).
1. Let _instantStart_ be ? GetTemporalInstantFor(_timeZone_, _dtStart_, *"compatible"*).
1. Let _startNs_ be _instantStart_.[[Nanoseconds]].
- 1. Let _endNs_ be ? AddZonedDateTime(_startNs_, _timeZone_, _calendar_, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _endNs_ be ? AddZonedDateTime(_startNs_, _timeZone_, _calendar_, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0).
1. Let _dayLengthNs_ be _endNs_ − _startNs_.
1. Let _roundResult_ be ? RoundDateTime(_temporalDateTime_.[[ISOYear]], _temporalDateTime_.[[ISOMonth]], _temporalDateTime_.[[ISODay]], _temporalDateTime_.[[ISOHour]], _temporalDateTime_.[[ISOMinute]], _temporalDateTime_.[[ISOSecond]], _temporalDateTime_.[[ISOMillisecond]], _temporalDateTime_.[[ISOMicrosecond]], _temporalDateTime_.[[ISONanosecond]], _roundingIncrement_, _smallestUnit_, _roundingMode_, _dayLengthNs_).
1. Let _offsetNanoseconds_ be ? GetOffsetNanosecondsFor(_timeZone_, _instant_).
@@ -1107,18 +1104,13 @@ InterpretTemporalZonedDateTimeOffset ( _year_, _month_, _day_, _hour_, _minu
- ToTemporalZonedDateTime ( _item_ [ , _constructor_ [ , _overflow_, _disambiguation_, _offset_ ] ] )
+ ToTemporalZonedDateTime ( _item_ [ , _constructor_ [ , _options_ ] ] )
The abstract operation ToTemporalZonedDateTime returns its argument _item_ if it is already a Temporal.ZonedDateTime instance, converts _item_ to a new Temporal.PlainDate instance if possible, and throws otherwise.
1. If _constructor_ is not given, set it to %Temporal.ZonedDateTime%.
- 1. If _overflow_ is not given, set it to *"constrain"*.
- 1. Assert: _overflow_ is either *"constrain"* or *"reject"*.
- 1. If _disambiguation_ is not given, set it to *"compatible"*.
- 1. Assert: _disambiguation_ is either *"compatible"*, *"earlier"*, *"later"*, or *"reject"*.
- 1. If _offset_ is not given, set it to *"reject"*.
- 1. Assert: _offset_ is either *"use"*, *"ignore"*, *"prefer"*, or *"reject"*.
+ 1. If _options_ is not given, set it to ! OrdinaryObjectCreate(%Object.prototype%).
1. If Type(_item_) is Object, then
1. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
1. Return _item_.
@@ -1129,8 +1121,9 @@ ToTemporalZonedDateTime ( _item_ [ , _constructor_ [ , _overflow_, _disambig
1. Set _timeZone_ to ? ToTemporalTimeZone(_timeZone_).
1. Let _offsetString_ be ? Get(_fields_, *"offset"*).
1. If _offsetString_ is not *undefined*, set it to ? ToString(_offsetString_).
- 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _item_, _overflow_).
+ 1. Let _result_ be ? InterpretTemporalDateTimeFields(_calendar_, _item_, _options_).
1. Else,
+ 1. Perform ? ToTemporalOverflow(_options_).
1. Let _string_ be ? ToString(_item_).
1. Let _result_ be ? ParseTemporalZonedDateTimeString(_string_).
1. If _result_.[[TimeZoneName]] is *undefined*, throw a *RangeError* exception.
@@ -1138,6 +1131,8 @@ ToTemporalZonedDateTime ( _item_ [ , _constructor_ [ , _overflow_, _disambig
1. Let _offsetString_ be _result_.[[TimeZoneOffsetString]].
1. Let _calendar_ be ? ToOptionalTemporalCalendar(_result_.[[Calendar]]).
1. Let _offsetNanoseconds_ be ? ParseTimeZoneOffsetString(_offsetString_).
+ 1. Let _disambiguation_ be ? ToTemporalDisambiguation(_options_).
+ 1. Let _offset_ be ? ToTemporalOffset(_options_, *"reject"*).
1. Let _epochNanoseconds_ be ? InterpretTemporalZonedDateTimeOffset(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]], _result_.[[Hour]], _result_.[[Minute]], _result_.[[Second]], _result_.[[Millisecond]], _result_.[[Microsecond]], _result_.[[Nanosecond]], _offsetNanoseconds_, _timeZone_, _disambiguation_, _offset_).
1. Return ? CreateTemporalZonedDateTimeFromStatic(_constructor_, _epochNanoseconds_, _timeZone_, _calendar_).
@@ -1349,7 +1344,7 @@ TemporalZonedDateTimeToString ( _zonedDateTime_, _precision_, _showCalendar_
- AddZonedDateTime ( _epochNanoseconds_, _timeZone_, _calendar_, _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _overflow_ )
+ AddZonedDateTime ( _epochNanoseconds_, _timeZone_, _calendar_, _years_, _months_, _weeks_, _days_, _hours_, _minutes_, _seconds_, _milliseconds_, _microseconds_, _nanoseconds_, _options_ )
The abstract operation AddZonedDateTime adds a duration in various units to a number of nanoseconds _epochNanoseconds_ since the Unix epoch, subject to the rules of _timeZone_ and _calendar_.
As specified in RFC 5545, the date portion of the duration is added in calendar days, and the time portion is added in exact time.
@@ -1362,8 +1357,6 @@
AddZonedDateTime ( _epochNanoseconds_, _timeZone_, _calendar_, _years_, _mon
1. Let _datePart_ be ? CreateTemporalDate(_temporalDateTime_.[[ISOYear]], _temporalDateTime_.[[ISOMonth]], _temporalDateTime_.[[ISODay]], _calendar_).
1. Let _dateAdd_ be ? Get(_calendar_, *"dateAdd"*).
1. Let _dateDuration_ be ? CreateTemporalDuration(_years_, _months_, _weeks_, _days_, 0, 0, 0, 0, 0, 0).
- 1. Let _options_ be ! OrdinaryObjectCreate(%Object.prototype%).
- 1. Perform ! CreateDataPropertyOrThrow(_options_, *"overflow"*, _overflow_).
1. Let _addedDate_ be ? Call(_dateAdd_, _calendar_, « _dateDuration_, _options_, %Temporal.PlainDate% »).
1. Let _intermediateDateTime_ be ? CreateTemporalDateTime(_addedDate_.[[ISOYear]], _addedDate_.[[ISOMonth]], _addedDate_.[[ISODay]], _temporalDateTime_.[[ISOHour]], _temporalDateTime_.[[ISOMinute]], _temporalDateTime_.[[ISOSecond]], _temporalDateTime_.[[ISOMillisecond]], _temporalDateTime_.[[ISOMicrosecond]], _temporalDateTime_.[[ISONanosecond]], _calendar_).
1. Let _intermediateInstant_ be ? GetTemporalInstantFor(_timeZone_, _intermediateDateTime_, *"compatible"*).
@@ -1372,7 +1365,7 @@ AddZonedDateTime ( _epochNanoseconds_, _timeZone_, _calendar_, _years_, _mon
- DifferenceZonedDateTime ( _ns1_, _ns2_, _timeZone_, _calendar_, _largestUnit_ )
+ DifferenceZonedDateTime ( _ns1_, _ns2_, _timeZone_, _calendar_, _largestUnit_ [ , _options_ ] )
The abstract operation DifferenceZonedDateTime computes the difference between two exact times expressed in nanoseconds since the Unix epoch, and balances the result so that there is no non-zero unit larger than _largestUnit_ in the result, taking calendar reckoning and time zone offset changes into account.
@@ -1384,8 +1377,8 @@ DifferenceZonedDateTime ( _ns1_, _ns2_, _timeZone_, _calendar_, _largestUnit
1. Let _startDateTime_ be ? GetTemporalDateTimeFor(_timeZone_, _startInstant_, _calendar_).
1. Let _endInstant_ be ? CreateInstant(_ns2_).
1. Let _endDateTime_ be ? GetTemporalDateTimeFor(_timeZone_, _endInstant_, _calendar_).
- 1. Let _dateDifference_ be ? DifferenceDateTime(_startDateTime_.[[ISOYear]], _startDateTime_.[[ISOMonth]], _startDateTime_.[[ISODay]], _startDateTime_.[[ISOHour]], _startDateTime_.[[ISOMinute]], _startDateTime_.[[ISOSecond]], _startDateTime_.[[ISOMillisecond]], _startDateTime_.[[ISOMicrosecond]], _startDateTime_.[[ISONanosecond]], _endDateTime_.[[ISOYear]], _endDateTime_.[[ISOMonth]], _endDateTime_.[[ISODay]], _endDateTime_.[[ISOHour]], _endDateTime_.[[ISOMinute]], _endDateTime_.[[ISOSecond]], _endDateTime_.[[ISOMillisecond]], _endDateTime_.[[ISOMicrosecond]], _endDateTime_.[[ISONanosecond]], _calendar_, _largestUnit_).
- 1. Let _intermediateNs_ be ? AddZonedDateTime(_ns1_, _timeZone_, _calendar_, _dateDifference_.[[Years]], _dateDifference_.[[Months]], _dateDifference_.[[Weeks]], 0, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _dateDifference_ be ? DifferenceDateTime(_startDateTime_.[[ISOYear]], _startDateTime_.[[ISOMonth]], _startDateTime_.[[ISODay]], _startDateTime_.[[ISOHour]], _startDateTime_.[[ISOMinute]], _startDateTime_.[[ISOSecond]], _startDateTime_.[[ISOMillisecond]], _startDateTime_.[[ISOMicrosecond]], _startDateTime_.[[ISONanosecond]], _endDateTime_.[[ISOYear]], _endDateTime_.[[ISOMonth]], _endDateTime_.[[ISODay]], _endDateTime_.[[ISOHour]], _endDateTime_.[[ISOMinute]], _endDateTime_.[[ISOSecond]], _endDateTime_.[[ISOMillisecond]], _endDateTime_.[[ISOMicrosecond]], _endDateTime_.[[ISONanosecond]], _calendar_, _largestUnit_, _options_).
+ 1. Let _intermediateNs_ be ? AddZonedDateTime(_ns1_, _timeZone_, _calendar_, _dateDifference_.[[Years]], _dateDifference_.[[Months]], _dateDifference_.[[Weeks]], 0, 0, 0, 0, 0, 0, 0).
1. Let _timeRemainderNs_ be _ns2_ − _intermediateNs_.
1. Let _intermediate_ be ? CreateTemporalZonedDateTime(_intermediateNs_, _timeZone_, _calendar_).
1. Let _result_ be ? NanosecondsToDays(_timeRemainderNs_, _intermediate_).
@@ -1418,15 +1411,15 @@ NanosecondsToDays ( _nanoseconds_, _relativeTo_ )
1. Let _endDateTime_ be ? GetTemporalDateTimeFor(_timeZone_, _endInstant_, _calendar_).
1. Let _dateDifference_ be ? DifferenceDateTime(_startDateTime_.[[ISOYear]], _startDateTime_.[[ISOMonth]], _startDateTime_.[[ISODay]], _startDateTime_.[[ISOHour]], _startDateTime_.[[ISOMinute]], _startDateTime_.[[ISOSecond]], _startDateTime_.[[ISOMillisecond]], _startDateTime_.[[ISOMicrosecond]], _startDateTime_.[[ISONanosecond]], _endDateTime_.[[ISOYear]], _endDateTime_.[[ISOMonth]], _endDateTime_.[[ISODay]], _endDateTime_.[[ISOHour]], _endDateTime_.[[ISOMinute]], _endDateTime_.[[ISOSecond]], _endDateTime_.[[ISOMillisecond]], _endDateTime_.[[ISOMicrosecond]], _endDateTime_.[[ISONanosecond]], _calendar_, *"days"*).
1. Let _days_ be _dateDifference_.[[Days]].
- 1. Let _intermediateNs_ be ? AddZonedDateTime(_startNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _intermediateNs_ be ? AddZonedDateTime(_startNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, 0, 0, 0, 0, 0, 0).
1. If _sign_ = 1, then
1. Repeat, while _days_ > 0 and _intermediateNs_ > _endNs_,
1. Set _days_ to _days_ − 1.
- 1. Set _intermediateNs_ to ? AddZonedDateTime(_startNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Set _intermediateNs_ to ? AddZonedDateTime(_startNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _days_, 0, 0, 0, 0, 0, 0).
1. Set _nanoseconds_ to _endNs_ − _intermediateNs_.
1. Let _done_ be *false*.
1. Repeat, while _done_ is *false*,
- 1. Let _oneDayFartherNs_ be ? AddZonedDateTime(_intermediateNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _sign_, 0, 0, 0, 0, 0, 0, *"constrain"*).
+ 1. Let _oneDayFartherNs_ be ? AddZonedDateTime(_intermediateNs_, _relativeTo_.[[TimeZone]], _relativeTo_.[[Calendar]], 0, 0, 0, _sign_, 0, 0, 0, 0, 0, 0).
1. Set _dayLengthNs_ to _oneDayFartherNs_ − _intermediateNs_.
1. If (_nanoseconds_ − _dayLengthNs_) × _sign_ ≥ 0, then
1. Set _nanoseconds_ to _nanoseconds_ − _dayLengthNs_.