Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.duration.compare
7 description: Leap second is a valid ISO string for TimeZone
8 features: [Temporal]
9 ---*/
10
11 let timeZone = "2016-12-31T23:59:60+00:00[UTC]";
12
13 // A string with a leap second is a valid ISO string, so the following
14 // operation should not throw
15
16 Temporal.Duration.compare(new Temporal.Duration(1), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
17
18 timeZone = "2021-08-19T17:30:45.123456789+23:59[+23:59:60]";
19 assert.throws(RangeError, () => Temporal.Duration.compare(new Temporal.Duration(1), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } }), "leap second in time zone name not valid");
20
21 reportCompare(0, 0);