mirror of https://github.com/tc39/test262.git
Expand Duration.compare test
This adds coverage for the situation where we get a different answer from Temporal.Duration.compare depending on whether relativeTo resolves to a PlainDate or ZonedDateTime. See discussion in https://github.com/tc39/test262/pull/3505#discussion_r859994610
This commit is contained in:
parent
65a7ace1cb
commit
8e0e2592d3
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue