diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js index df0b0d0312..aa45194b3a 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDate/prototype/since/order-of-operations.js @@ -136,7 +136,13 @@ const expectedOpsForYearRounding = expected.concat([ "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -159,7 +165,13 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherDatePropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months/weeks"); actual.splice(0); // clear @@ -175,7 +187,10 @@ const expectedOpsForMonthRounding = expected.concat([ "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.since(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear @@ -189,6 +204,9 @@ const expectedOpsForWeekRounding = expected.concat([ "call this.calendar.dateUntil", // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.since(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js index b61c7465f5..373072e626 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDate/prototype/until/order-of-operations.js @@ -137,7 +137,13 @@ const expectedOpsForYearRounding = expected.concat([ "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -160,7 +166,13 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDatePropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months/weeks"); actual.splice(0); // clear @@ -176,7 +188,10 @@ const expectedOpsForMonthRounding = expected.concat([ "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.until(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear @@ -190,6 +205,9 @@ const expectedOpsForWeekRounding = expected.concat([ "call this.calendar.dateUntil", // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.until(otherDatePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js index ca4cde85b1..048024860f 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/order-of-operations.js @@ -166,7 +166,13 @@ const expectedOpsForYearRounding = expected.concat([ "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -195,7 +201,13 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDatePropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months/weeks"); actual.splice(0); // clear @@ -211,7 +223,10 @@ const expectedOpsForMonthRounding = expected.concat([ "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear @@ -225,6 +240,9 @@ const expectedOpsForWeekRounding = expected.concat([ "call this.calendar.dateUntil", // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js index e937fdbdb6..026a443b57 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/order-of-operations.js @@ -166,7 +166,13 @@ const expectedOpsForYearRounding = expected.concat([ "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -195,7 +201,13 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDatePropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months/weeks"); actual.splice(0); // clear @@ -211,7 +223,10 @@ const expectedOpsForMonthRounding = expected.concat([ "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -225,6 +240,9 @@ const expectedOpsForWeekRounding = expected.concat([ "call this.calendar.dateUntil", // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js index 55e4b57507..5757cce9f5 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/order-of-operations.js @@ -161,11 +161,18 @@ actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest year: const expectedOpsForYearRounding = expected.concat([ + // RoundDuration "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -181,16 +188,29 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherYearMonthPropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); -assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years"); +assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest month: const expectedOpsForMonthRounding = expected.concat([ + // RoundDuration "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "months", roundingIncrement: 2 })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-non-integer.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-non-integer.js index 985ee9f20b..97513e2147 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-non-integer.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-non-integer.js @@ -20,5 +20,5 @@ const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2000, 10); const result = later.since(earlier, { roundingIncrement: 2.5, roundingMode: "trunc" }); TemporalHelpers.assertDuration(result, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, "roundingIncrement 2.5 truncates to 2"); -const result2 = later.since(earlier, { smallestUnit: "months", roundingIncrement: 1e9 + 0.5, roundingMode: "expand" }); +const result2 = later.since(earlier, { largestUnit: "months", smallestUnit: "months", roundingIncrement: 1e9 + 0.5, roundingMode: "expand" }); TemporalHelpers.assertDuration(result2, 0, 1e9, 0, 0, 0, 0, 0, 0, 0, 0, "roundingIncrement 1e9 + 0.5 truncates to 1e9"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js index cbeb40b297..11c3d93769 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/order-of-operations.js @@ -161,11 +161,18 @@ actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest year: const expectedOpsForYearRounding = expected.concat([ + // RoundDuration "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear @@ -181,17 +188,30 @@ const expectedOpsForYearRoundingSameMonth = expected.concat([ "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.o not called because months and weeks == 0) + // (7.o not called because months and weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherYearMonthPropertyBagSameMonth, createOptionsObserver({ smallestUnit: "years" })); -assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years"); +assert.compareArray(actual, expectedOpsForYearRoundingSameMonth, "order of operations with smallestUnit = years and no excess months"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest month: const expectedOpsForMonthRounding = expected.concat([ + // RoundDuration "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherYearMonthPropertyBag, createOptionsObserver({ smallestUnit: "months", roundingIncrement: 2 })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-non-integer.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-non-integer.js index 0f7f40bec5..84360e132c 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-non-integer.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-non-integer.js @@ -20,5 +20,5 @@ const earlier = new Temporal.PlainYearMonth(2000, 5); const later = new Temporal.PlainYearMonth(2000, 10); const result = earlier.until(later, { roundingIncrement: 2.5, roundingMode: "trunc" }); TemporalHelpers.assertDuration(result, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, "roundingIncrement 2.5 truncates to 2"); -const result2 = earlier.until(later, { smallestUnit: "months", roundingIncrement: 1e9 + 0.5, roundingMode: "expand" }); +const result2 = earlier.until(later, { largestUnit: "months", smallestUnit: "months", roundingIncrement: 1e9 + 0.5, roundingMode: "expand" }); TemporalHelpers.assertDuration(result2, 0, 1e9, 0, 0, 0, 0, 0, 0, 0, 0, "roundingIncrement 1e9 + 0.5 truncates to 1e9"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateadd-called-with-options-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateadd-called-with-options-undefined.js index ea8e220b1e..72048fde25 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateadd-called-with-options-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateadd-called-with-options-undefined.js @@ -29,8 +29,9 @@ assert.sameValue(calendar.dateAddCallCount, 1, "basic difference with largestUni // RoundDuration -> // MoveRelativeZonedDateTime -> AddZonedDateTime -> calendar.dateAdd() // MoveRelativeDate -> calendar.dateAdd() +// BalanceDurationRelative -> MoveRelativeDate -> calendar.dateAdd() calendar.dateAddCallCount = 0; later1.since(earlier, { smallestUnit: "weeks" }); -assert.sameValue(calendar.dateAddCallCount, 3, "rounding difference with calendar smallestUnit"); +assert.sameValue(calendar.dateAddCallCount, 4, "rounding difference with calendar smallestUnit"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js index 6f6e4eaf08..3a6248bb21 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js @@ -77,7 +77,7 @@ TemporalHelpers.checkCalendarDateUntilLargestUnitSingular( later.since(earlier, { largestUnit, roundingIncrement: 2, roundingMode: 'ceil' }); }, { - years: ["year", "year"], + years: ["year", "year", "month"], months: ["month", "month"], weeks: ["week", "week"], days: [], @@ -100,7 +100,7 @@ TemporalHelpers.checkCalendarDateUntilLargestUnitSingular( later.since(earlier, { smallestUnit }); }, { - years: ["year", "year"], + years: ["year", "year", "month"], months: ["month"], weeks: ["week"], days: [], diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js index f232acb18d..f52574cae7 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/order-of-operations.js @@ -358,29 +358,44 @@ actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest year: const expectedOpsForYearRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest month: const expectedOpsForMonthRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest week: const expectedOpsForWeekRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.since(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); actual.splice(0); // clear diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateadd-called-with-options-undefined.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateadd-called-with-options-undefined.js index 82cdb9e137..f09efe1221 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateadd-called-with-options-undefined.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateadd-called-with-options-undefined.js @@ -29,8 +29,9 @@ assert.sameValue(calendar.dateAddCallCount, 1, "basic difference with largestUni // RoundDuration -> // MoveRelativeZonedDateTime -> AddZonedDateTime -> calendar.dateAdd() // MoveRelativeDate -> calendar.dateAdd() +// BalanceDurationRelative -> MoveRelativeDate -> calendar.dateAdd() calendar.dateAddCallCount = 0; earlier.until(later1, { smallestUnit: "weeks" }); -assert.sameValue(calendar.dateAddCallCount, 3, "rounding difference with calendar smallestUnit"); +assert.sameValue(calendar.dateAddCallCount, 4, "rounding difference with calendar smallestUnit"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js index 6842f08dcf..045de13856 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js @@ -77,7 +77,7 @@ TemporalHelpers.checkCalendarDateUntilLargestUnitSingular( earlier.until(later, { largestUnit, roundingIncrement: 2, roundingMode: 'ceil' }); }, { - years: ["year", "year"], + years: ["year", "year", "month"], months: ["month", "month"], weeks: ["week", "week"], days: [], @@ -100,7 +100,7 @@ TemporalHelpers.checkCalendarDateUntilLargestUnitSingular( earlier.until(later, { smallestUnit }); }, { - years: ["year", "year"], + years: ["year", "year", "month"], months: ["month"], weeks: ["week"], days: [], diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js index d15ccfe5a2..893444ccec 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/order-of-operations.js @@ -358,29 +358,44 @@ actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest year: const expectedOpsForYearRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 7.e "call this.calendar.dateAdd", // 7.g "call this.calendar.dateUntil", // 7.o "call this.calendar.dateAdd", // 7.y MoveRelativeDate -]); // (7.s not called because other units can't add up to >1 year at this point) + // (7.s not called because other units can't add up to >1 year at this point) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 11.c MoveRelativeDate + "call this.calendar.dateAdd", // 11.g MoveRelativeDate + "call this.calendar.dateAdd", // 11.k + "call this.calendar.dateUntil" // 11.n +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "years" })); assert.compareArray(actual, expectedOpsForYearRounding, "order of operations with smallestUnit = years"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest month: const expectedOpsForMonthRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 10.c "call this.calendar.dateAdd", // 10.e "call this.calendar.dateAdd", // 10.k MoveRelativeDate -]); // (10.n.iii MoveRelativeDate not called because weeks == 0) + // (10.n.iii MoveRelativeDate not called because weeks == 0) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 12.b MoveRelativeDate +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "months" })); assert.compareArray(actual, expectedOpsForMonthRounding, "order of operations with smallestUnit = months"); actual.splice(0); // clear // code path through RoundDuration that rounds to the nearest week: const expectedOpsForWeekRounding = expected.concat(expectedOpsForCalendarDifference, expectedOpsForCalendarRounding, [ + // RoundDuration "call this.calendar.dateAdd", // 11.d MoveRelativeDate -]); // (11.g.iii MoveRelativeDate not called because days already balanced) + // (11.g.iii MoveRelativeDate not called because days already balanced) + // BalanceDurationRelative + "call this.calendar.dateAdd", // 13.c MoveRelativeDate +]); instance.until(otherDateTimePropertyBag, createOptionsObserver({ smallestUnit: "weeks" })); assert.compareArray(actual, expectedOpsForWeekRounding, "order of operations with smallestUnit = weeks"); actual.splice(0); // clear