Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/from/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.plainyearmonth.from
7 description: Leap second is a valid ISO string for PlainYearMonth
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 let arg = "2016-12-31T23:59:60";
13
14 const result1 = Temporal.PlainYearMonth.from(arg);
15 TemporalHelpers.assertPlainYearMonth(
16 result1,
17 2016, 12, "M12",
18 "leap second is a valid ISO string for PlainYearMonth"
19 );
20
21 const result2 = Temporal.PlainYearMonth.from(arg, { overflow: "reject" });
22 TemporalHelpers.assertPlainYearMonth(
23 result2,
24 2016, 12, "M12",
25 "leap second is a valid ISO string for PlainYearMonth"
26 );
27
28 arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 };
29
30 const result3 = Temporal.PlainYearMonth.from(arg);
31 TemporalHelpers.assertPlainYearMonth(
32 result3,
33 2016, 12, "M12",
34 "second: 60 is ignored in property bag for PlainYearMonth"
35 );
36
37 const result4 = Temporal.PlainYearMonth.from(arg, { overflow: "reject" });
38 TemporalHelpers.assertPlainYearMonth(
39 result4,
40 2016, 12, "M12",
41 "second: 60 is ignored in property bag for PlainYearMonth even with overflow: reject"
42 );
43
44 reportCompare(0, 0);