summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-leap-second.js
blob: c3436f7d6bdd6f61f23feb762a3625f9af6ffb93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.from
description: Leap second is a valid ISO string for PlainDate
includes: [temporalHelpers.js]
features: [Temporal]
---*/

let arg = "2016-12-31T23:59:60";

const result1 = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(
  result1,
  2016, 12, "M12", 31,
  "leap second is a valid ISO string for PlainDate"
);

const result2 = Temporal.PlainDate.from(arg, { overflow: "reject" });
TemporalHelpers.assertPlainDate(
  result2,
  2016, 12, "M12", 31,
  "leap second is a valid ISO string for PlainDate"
);

arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 };

const result3 = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(
  result3,
  2016, 12, "M12", 31,
  "second: 60 is ignored in property bag for PlainDate"
);

const result4 = Temporal.PlainDate.from(arg, { overflow: "reject" });
TemporalHelpers.assertPlainDate(
  result4,
  2016, 12, "M12", 31,
  "second: 60 is ignored in property bag for PlainDate even with overflow: reject"
);

reportCompare(0, 0);