summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDate/argument-invalid.js
blob: 4e1191ee98bd819d6c3b4461f2f4b1da96410b08 (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
// |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
description: PlainDate constructor with invalid iso dates
features: [Temporal]
---*/

const tests = [
  [2020, 0, 24],
  [2020, 13, 24],
  [2020, -3, 24],
  [2020, 12, 32],
  [2020, 2, 30],
  [2019, 2, 29],
  [2019, 2, 0],
  [2019, 2, -20],
];

for (const [year, month, day] of tests) {
  assert.throws(RangeError, () => new Temporal.PlainDate(year, month, day),
    `year=${year}, month=${month}, day=${day}`);
}

reportCompare(0, 0);