tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

constructor-invalid-offset-timezone.js (783B)


      1 // Copyright 2023 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-createdatetimeformat
      5 description: Tests that invalid offset time zones are rejected.
      6 ---*/
      7 let invalidOffsetTimeZones = [
      8    '+3',
      9    '+24',
     10    '+23:0',
     11    '+130',
     12    '+13234',
     13    '+135678',
     14    '-7',
     15    '-10.50',
     16    '-10,50',
     17    '-24',
     18    '-014',
     19    '-210',
     20    '-2400',
     21    '-1:10',
     22    '-21:0',
     23    '+0:003',
     24    '+15:59:00',
     25    '+15:59.50',
     26    '+15:59,50',
     27    '+222700',
     28    '-02:3200',
     29    '-170100',
     30    '-22230',
     31 ];
     32 invalidOffsetTimeZones.forEach((timeZone) => {
     33    assert.throws(RangeError, function() {
     34        new Intl.DateTimeFormat(undefined, {timeZone});
     35    }, timeZone + ":");
     36 });
     37 
     38 reportCompare(0, 0);