test262/test/intl402/DateTimeFormat/constructor-invalid-offset-...

37 lines
761 B
JavaScript
Raw Permalink Normal View History

Add test for ECMA402 PR 788 (#3917) * Add test for ECMA402 PR 788 https://github.com/tc39/ecma402/pull/788 * Fix misunderstanding about "+00:00" * Fix lint * Swap actual, expected position * Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-basic.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> * Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js Co-authored-by: Richard Gibson <richard.gibson@gmail.com> --------- Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-09-26 18:22:50 +02:00
// 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 + ":");
});