summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js
blob: d999f188a87bdf0a42b8e3afb2770cd1052c3984 (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
// Copyright 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-createdatetimeformat
description: Tests that invalid offset time zones are rejected.
---*/
let invalidOffsetTimeZones = [
    '+3',
    '+24',
    '+23:0',
    '+130',
    '+13234',
    '+135678',
    '-7',
    '-10.50',
    '-10,50',
    '-24',
    '-014',
    '-210',
    '-2400',
    '-1:10',
    '-21:0',
    '+0:003',
    '+15:59:00',
    '+15:59.50',
    '+15:59,50',
    '+222700',
    '-02:3200',
    '-170100',
    '-22230',
];
invalidOffsetTimeZones.forEach((timeZone) => {
    assert.throws(RangeError, function() {
        new Intl.DateTimeFormat(undefined, {timeZone});
    }, timeZone + ":");
});

reportCompare(0, 0);