forked from tc39/test262
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional tests for out-of-range date-times
- tc39/proposal-temporal#2727 (comment) - tc39/proposal-temporal#2727 (comment) - tc39/proposal-temporal#2727 (comment)
- Loading branch information
1 parent
2b3725b
commit 04e26c6
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...ration/compare/relativeto-plaindate-add24hourdaystonormalizedtimeduration-out-of-range.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.duration.compare | ||
description: RangeError thrown if adding the duration to the relativeTo date would result in anout-of-range date-time | ||
features: [Temporal] | ||
includes: [temporalHelpers.js] | ||
---*/ | ||
|
||
let duration1 = Temporal.Duration.from({ | ||
years: 1, | ||
seconds: 2**53 - 1, | ||
}); | ||
let duration2 = Temporal.Duration.from({ | ||
years: 2, | ||
}); | ||
let relativeTo = new Temporal.PlainDate(2000, 1, 1); | ||
|
||
assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, { relativeTo })); | ||
assert.throws(RangeError, () => Temporal.Duration.compare(duration2, duration1, { relativeTo })); |
17 changes: 17 additions & 0 deletions
17
...rototype/total/relativeto-plaindate-add24hourdaystonormalizedtimeduration-out-of-range.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.duration.compare | ||
description: RangeError thrown if adding the duration to the relativeTo date would result in anout-of-range date-time | ||
features: [Temporal] | ||
includes: [temporalHelpers.js] | ||
---*/ | ||
|
||
let duration = Temporal.Duration.from({ | ||
years: 1, | ||
seconds: 2**53 - 1, | ||
}); | ||
let relativeTo = new Temporal.PlainDate(2000, 1, 1); | ||
|
||
assert.throws(RangeError, () => duration.total({ relativeTo, unit: "days" })); |