tor-browser

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

time-zone-2038-pst.js (1827B)


      1 // |reftest| skip-if(!xulRuntime.shell)
      2 
      3 assertEq(/^(PST|PDT)$/.test(getTimeZone()), true,
      4         "The default time zone is set to PST8PDT for all jstests (when run in the shell)");
      5 
      6 // U.S. daylight saving rules changed in 2007, excerpt from tzdata's
      7 // northamerica file:
      8 // NAME  FROM  TO    IN   ON       AT    SAVE  LETTER/S
      9 // US    1967  2006  Oct  lastSun  2:00  0     S
     10 // US    1967  1973  Apr  lastSun  2:00  1:00  D
     11 // US    1974  only  Jan  6        2:00  1:00  D
     12 // US    1975  only  Feb  23       2:00  1:00  D
     13 // US    1976  1986  Apr  lastSun  2:00  1:00  D
     14 // US    1987  2006  Apr  Sun>=1   2:00  1:00  D
     15 // US    2007  max   Mar  Sun>=8   2:00  1:00  D
     16 // US    2007  max   Nov  Sun>=1   2:00  0     S
     17 
     18 
     19 // When 2040 is mapped to 1984, the old U.S. rules are applied, i.e. DST isn't
     20 // yet observed on March 31. If mapped to 2012, the new U.S. rules are applied
     21 // and DST is already observed, which is the expected behaviour.
     22 // A similar effect is visible in November.
     23 // NOTE: This test expects that 2012 and 2040 use the same DST rules. If this
     24 //       ever changes, the test needs to be updated accordingly.
     25 {
     26    let dt1 = new Date(2040, Month.March, 31);
     27    assertDateTime(dt1, "Sat Mar 31 2040 00:00:00 GMT-0700 (PDT)", "Pacific Daylight Time");
     28 
     29    let dt2 = new Date(2040, Month.November, 1);
     30    assertDateTime(dt2, "Thu Nov 01 2040 00:00:00 GMT-0700 (PDT)", "Pacific Daylight Time");
     31 }
     32 
     33 // 2038 is mapped to 2027 instead of 1971.
     34 {
     35    let dt1 = new Date(2038, Month.March, 31);
     36    assertDateTime(dt1, "Wed Mar 31 2038 00:00:00 GMT-0700 (PDT)", "Pacific Daylight Time");
     37 
     38    let dt2 = new Date(2038, Month.November, 1);
     39    assertDateTime(dt2, "Mon Nov 01 2038 00:00:00 GMT-0700 (PDT)", "Pacific Daylight Time");
     40 }
     41 
     42 if (typeof reportCompare === "function")
     43    reportCompare(true, true);