bigeasy / timezone

Full-blown timezone aware date math and formatting for JavaScript in 2.7k.
http://bigeasy.github.io/timezone
MIT License
255 stars 26 forks source link

Planned updates for new timezone databases? #321

Open carlegbert opened 4 years ago

carlegbert commented 4 years ago

Hi, It looks like it's been a little while since you have updated this library. Do you plan to continue updating/maintaining it?

I made an attempt at updating the eggert dependency in order to pull in the 2019c release, but unfortunately ran into some build failures when running make- specifically, the script seems to go into an infinite loop somewhere in this function, when it reaches Asia/Hong_Kong. If you're able to provide some guidance on what might need to be updated to make the build work, I may be able to take a crack at submitting a patch. Thank you!

bigeasy commented 4 years ago

Yes. Sorry. Will update.

detrout commented 4 years ago

I also stumbled on the bug. I rolled back the Asia/Hong_Kong timezone changes to match 2018i and it still hit the infinite loop. If I delete the Asia/Hong_Kong block it continues and dies on Asia/Jerusalem.

detrout commented 1 year ago

I got timezone to build with the 2022c release of the timezone database.

I had to make two kinds of changes.

I patched a couple of rules back to what was in the 2018 tz database.

--- a/tzdata/asia
+++ b/tzdata/asia
@@ -848,7 +848,7 @@
 Rule   HK      1948    only    -       May     2       3:30s   1:00    S
 Rule   HK      1948    1952    -       Oct     Sun>=28 3:30s   0       -
 Rule   HK      1949    1953    -       Apr     Sun>=1  3:30    1:00    S
-Rule   HK      1953    1964    -       Oct     Sun>=31 3:30    0       -
+Rule   HK      1953    1964    -       Oct     lastSun 3:30    0       -
 Rule   HK      1954    1964    -       Mar     Sun>=18 3:30    1:00    S
 Rule   HK      1965    1976    -       Apr     Sun>=16 3:30    1:00    S
 Rule   HK      1965    1976    -       Oct     Sun>=16 3:30    0       -
@@ -2026,7 +2026,7 @@
 #      ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps

 # Rule NAME    FROM    TO      -       IN      ON      AT      SAVE    LETTER/S
-Rule   Zion    2005    2012    -       Apr     Fri<=1  2:00    1:00    D
+Rule   Zion    2005    2012    -       Apr      1      2:00    1:00    D
 Rule   Zion    2005    only    -       Oct      9      2:00    0       S
 Rule   Zion    2006    only    -       Oct      1      2:00    0       S
 Rule   Zion    2007    only    -       Sep     16      2:00    0       S
--- a/tzdata/europe
+++ b/tzdata/europe
@@ -3700,7 +3700,7 @@
 Rule   Turkey  1964    only    -       May     15      0:00    1:00    S
 Rule   Turkey  1964    only    -       Oct      1      0:00    0       -
 Rule   Turkey  1973    only    -       Jun      3      1:00    1:00    S
-Rule   Turkey  1973    1976    -       Oct     Sun>=31 2:00    0       -
+Rule   Turkey  1973    1976    -       Nov      4      2:00    0       -
 Rule   Turkey  1974    only    -       Mar     31      2:00    1:00    S
 Rule   Turkey  1975    only    -       Mar     22      2:00    1:00    S
 Rule   Turkey  1976    only    -       Mar     21      2:00    1:00    S

And I modified the zones.js to just ignore problems with February.

One rule that went to 2029 somehow triggered the getUTCDay() == i (which was 4 for thursday) and getUTCMonth() was 2.

--- a/util/zones.js
+++ b/util/zones.js
@@ -74,14 +74,6 @@
     } else if (date[2]) {
       for (i = 0, I = ABBREV.length; i < I; i++)
         if (ABBREV[i] === date[2]) break;
-      if (e.month == 1) {
-        for (var year = e.from; year <= e.to; year++) {
-          var fields = new Date(Date.UTC(year, 1, 29));
-          if (fields.getUTCDay() == i && fields.getUTCMonth() != 1) {
-            throw new Error("Last day Februrary: " + key + ", " + i + ", " + fields.getUTCDay() + ", " + fields.getUTCMonth() + ", " + year);
-          }
-        }
-      }
       day = [ i, -daysInMonth[e.month] ];
     } else {
       for (i = 0, I = ABBREV.length; i < I; i++)

Maybe this might hint at what the problem is.