Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/compare/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.plaindate.compare
7 description: Leap second is a valid ISO string for PlainDate
8 features: [Temporal]
9 ---*/
10
11 let arg = "2016-12-31T23:59:60";
12 let result = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(2016, 12, 31));
13 assert.sameValue(result, 0, "leap second is a valid ISO string for PlainDate (first argument)");
14 result = Temporal.PlainDate.compare(new Temporal.PlainDate(2016, 12, 31), arg);
15 assert.sameValue(result, 0, "leap second is a valid ISO string for PlainDate (second argument)");
16
17 arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 };
18 result = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(2016, 12, 31));
19 assert.sameValue(result, 0, "second: 60 is ignored in property bag for PlainDate (first argument)");
20 result = Temporal.PlainDate.compare(new Temporal.PlainDate(2016, 12, 31), arg);
21 assert.sameValue(result, 0, "second: 60 is ignored in property bag for PlainDate (second argument)");
22
23 reportCompare(0, 0);