tor-browser

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

constructor-options-timeZoneName-invalid.js (935B)


      1 // Copyright 2021 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: >
      6  Invalid values for the `timeZoneName` option of the DateTimeFormat constructor
      7 features: [Intl.DateTimeFormat-extend-timezonename]
      8 ---*/
      9 
     10 assert.throws(RangeError, function () {
     11  new Intl.DateTimeFormat('en', { timeZoneName: '' });
     12 }, 'empty string');
     13 
     14 assert.throws(RangeError, function () {
     15  new Intl.DateTimeFormat('en', { timeZoneName: 'short ' });
     16 }, '"short "');
     17 
     18 assert.throws(RangeError, function () {
     19  new Intl.DateTimeFormat('en', { timeZoneName: ' long' });
     20 }, '" long"');
     21 
     22 assert.throws(RangeError, function () {
     23  new Intl.DateTimeFormat('en', { timeZoneName: 'offset' });
     24 }, '"offset"');
     25 
     26 assert.throws(RangeError, function () {
     27  new Intl.DateTimeFormat('en', { timeZoneName: 'generic' });
     28 }, '"generic"');
     29 
     30 reportCompare(0, 0);