diff --git a/test/built-ins/Temporal/Duration/compare/relativeto-hour.js b/test/built-ins/Temporal/Duration/compare/relativeto-hour.js index 149885e1db..876d865cdf 100644 --- a/test/built-ins/Temporal/Duration/compare/relativeto-hour.js +++ b/test/built-ins/Temporal/Duration/compare/relativeto-hour.js @@ -4,6 +4,7 @@ /*--- esid: sec-temporal.duration.compare description: relativeTo with hours. +includes: [temporalHelpers.js] features: [Temporal] ---*/ @@ -22,3 +23,19 @@ assert.sameValue(Temporal.Duration.compare(oneDay, hours24, { relativeTo: "2019- assert.sameValue(Temporal.Duration.compare(oneDay, hours24, { relativeTo: { year: 2019, month: 11, day: 3 } }), 0, "casts relativeTo to PlainDate from object"); + +const timeZone = TemporalHelpers.springForwardFallBackTimeZone(); +assert.sameValue( + Temporal.Duration.compare(oneDay, hours24, { relativeTo: new Temporal.ZonedDateTime(0n, timeZone) }), + 0, + 'relativeTo does not affect days if ZonedDateTime, and duration encompasses no DST change'); +assert.sameValue( + Temporal.Duration.compare(oneDay, hours24, { relativeTo: new Temporal.ZonedDateTime(972802800_000_000_000n, timeZone) }), + 1, + 'relativeTo does affect days if ZonedDateTime, and duration encompasses DST change'); +assert.sameValue( + Temporal.Duration.compare(oneDay, hours24, { + relativeTo: { year: 2000, month: 10, day: 29, timeZone } + }), + 1, + 'casts relativeTo to ZonedDateTime from object');