tor-browser

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

timezone-legacy-non-iana.js (806B)


      1 // Copyright (C) 2024 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-initializedatetimeformat
      6 description: Only IANA time zone identifiers are allowed.
      7 ---*/
      8 
      9 // List of non-IANA link names, copied from:
     10 // https://github.com/unicode-org/icu/blob/main/icu4c/source/tools/tzcode/icuzones
     11 const invalidTimeZones = [
     12  "ACT",
     13  "AET",
     14  "AGT",
     15  "ART",
     16  "AST",
     17  "BET",
     18  "BST",
     19  "CAT",
     20  "CNT",
     21  "CST",
     22  "CTT",
     23  "EAT",
     24  "ECT",
     25  "IET",
     26  "IST",
     27  "JST",
     28  "MIT",
     29  "NET",
     30  "NST",
     31  "PLT",
     32  "PNT",
     33  "PRT",
     34  "PST",
     35  "SST",
     36  "VST",
     37 ];
     38 
     39 for (let timeZone of invalidTimeZones) {
     40  assert.throws(RangeError, () => {
     41    new Intl.DateTimeFormat(undefined, {timeZone});
     42  }, "Time zone: " + timeZone);
     43 }
     44 
     45 reportCompare(0, 0);