Skip to content

Commit

Permalink
Update time zone database to 2024b
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Sep 12, 2024
1 parent a58486f commit fcbbb77
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is a fork of [darkskyapp/tz-lookup](https://github.com/darkskyapp/tz-lookup
The following updates have been made to this fork:

- The time zone database uses
[2024a](https://github.com/evansiroky/timezone-boundary-builder/releases/tag/2024a). Expect a bunch of changes if you're upgrading from the original `tz-lookup`, including new zone names and shapes.
[2024b](https://github.com/evansiroky/timezone-boundary-builder/releases/tag/2024b). Expect a bunch of changes if you're upgrading from the original `tz-lookup`, including new zone names and shapes.

- TypeScript types are now included.

Expand Down
17 changes: 14 additions & 3 deletions rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ set -ex

# Remember to update the README.md with the new version!
# Latest release is here: https://github.com/evansiroky/timezone-boundary-builder/releases
TZ="2024a"

TZ="2024b"

rm -rf timezones.geojson.zip dist ne_10m_urban_areas.*
curl -L --retry 3 -C - \
Expand All @@ -16,6 +15,18 @@ curl -L --retry 3 -C - \
# 76b8c5786af5df4fa18ae615e594347fb464525347038b15f9df15d1396cb7de ne_10m_urban_areas.shp
# d387658168a5974d5c8b858af2220c0fdcdfa5b69646d36839e358519816140e ne_10m_urban_areas.shx

unzip -u timezones.geojson.zip
# -o: overwrite existing files
# -u: update existing files and create new ones if needed
unzip -o -u timezones.geojson.zip
ogr2ogr -f GeoJSON ne_10m_urban_areas.json ne_10m_urban_areas.shp
# pack.js takes about a minute to complete.

# `uglifyjs -mc` takes 300ms and results in a 73k file.

# `terser --compress --mangle` takes ~300ms but is 15 bytes larger.

# `esbuild --minify` takes 200ms and is 10 bytes larger.

# the packed sizes are very similar as most of the payload
# is the encoded quadtree.
node pack.js | ./node_modules/.bin/uglifyjs -mc >tz.js
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ describe("tzlookup", function () {
[[64.0877, 20.1457], "Europe/Stockholm"],
[[73.5927, -115.9105], "America/Edmonton"],
[[51.8279, -84.3882], "America/Toronto"],
// [[56.5034, -108.7968], "America/Regina"], // doesn't agree with geo-tz
[[56.5034, -108.7968], "America/Regina"],
[[55.2477, 64.4429], "Asia/Yekaterinburg"],
[[79.9054, -80.5558], "America/Iqaluit"],
[[68.1178, 137.7878], "Asia/Vladivostok"],
Expand All @@ -452,7 +452,7 @@ describe("tzlookup", function () {
[[78.2319, -35.9009], "America/Nuuk"],
[[50.4043, 20.1115], "Europe/Warsaw"],
[[67.7007, -139.1173], "America/Dawson"],
[[46.7656, 96.6875], "Asia/Hovd"],
[[46.7656, 96.6875], "Asia/Ulaanbaatar"],
[[-22.5825, 29.4276], "Africa/Johannesburg"],
[[59.9827, 92.8622], "Asia/Krasnoyarsk"],
[[32.2351, 74.7128], "Asia/Karachi"],
Expand Down Expand Up @@ -937,7 +937,7 @@ describe("tzlookup", function () {
[[10.9729, 104.4684], "Asia/Phnom_Penh"],
[[23.1465, 85.6926], "Asia/Kolkata"],
[[79.2684, -76.192], "America/Iqaluit"],
[[48.3757, 113.5456], "Asia/Choibalsan"],
[[48.3757, 113.5456], "Asia/Ulaanbaatar"],
[[60.9356, -92.9832], "America/Rankin_Inlet"],
[[-22.592, -52.6535], "America/Sao_Paulo"],
[[31.451, -87.0409], "America/Chicago"],
Expand Down
2 changes: 1 addition & 1 deletion tz.js

Large diffs are not rendered by default.

0 comments on commit fcbbb77

Please sign in to comment.