Rewrite mkFourTwentyTz in JS (instead of Python)
parent
971ee4190d
commit
6896b282b2
|
|
@ -0,0 +1,4 @@
|
||||||
|
timezonedb.csv.zip
|
||||||
|
country.csv
|
||||||
|
zone.csv
|
||||||
|
timezone.csv
|
||||||
|
|
@ -4,12 +4,20 @@ A clock that tells when and where it's going to be [4:20](https://en.wikipedia.o
|
||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
## Note
|
## Generating `fourTwentyTz.js`
|
||||||
|
|
||||||
Once in a while, there'd be updates to the [timezone database](https://timezonedb.com/download) which
|
Once in a while we need to regenerate it for 2 reasons:
|
||||||
would require updating `fourTwentyTz.js`. I'll do my best to release a new version every time this happens,
|
|
||||||
but if you ever need to do this yourself, just run `python mkFourTwentyTz.py` (after downloading the timezone CSV files.
|
* One or more places got in or out of daylight saving time (DST) mode.
|
||||||
See comment at the top of the script).
|
* The database saying _when_ places enter/exit DST mode got updated.
|
||||||
|
|
||||||
|
I'll do my best to release a new version every time this happens,
|
||||||
|
but if you ever need to do this yourself, here's how:
|
||||||
|
|
||||||
|
* `cd` to the `ftclock` folder
|
||||||
|
* If you haven't done so yet, run `npm install` there (this would create the `node_modules` folder).
|
||||||
|
* Get and unzip the latest `timezone.csv.zip` from https://timezonedb.com/download
|
||||||
|
* Run `npm run make`
|
||||||
|
|
||||||
## Creator
|
## Creator
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,536 +1,463 @@
|
||||||
// Generated by mk420tz.py - see https://github.com/thedod/BangleApps/420clock
|
// Generated by mkFourTwentyTz.js
|
||||||
// (version: Sat Dec 18 10:17:32 2021)
|
|
||||||
// Data source: https://timezonedb.com/files/timezonedb.csv.zip
|
// Data source: https://timezonedb.com/files/timezonedb.csv.zip
|
||||||
// (version: Sat Oct 16 01:48:14 2021)
|
// Sun Jan 09 2022 13:21:47 GMT+0200 (Israel Standard Time)
|
||||||
exports.timezones = [
|
exports.timezones = {
|
||||||
[
|
"0": [
|
||||||
1380,
|
"Troll, Antarctica",
|
||||||
[
|
"Ouagadougou, Burkina Faso",
|
||||||
"Azores, Portugal",
|
"Abidjan, Côte d'Ivoire",
|
||||||
"Cape Verde, Cabo Verde",
|
"Canary, Spain",
|
||||||
"Scoresbysund, Greenland"
|
"Faroe, Faroe Islands",
|
||||||
]
|
"London, United Kingdom of Great Britain and Northern Ireland",
|
||||||
],
|
"Guernsey, Guernsey",
|
||||||
[
|
"Accra, Ghana",
|
||||||
1320,
|
"Danmarkshavn, Greenland",
|
||||||
[
|
"Banjul, Gambia",
|
||||||
"Noronha, Brazil",
|
"Conakry, Guinea",
|
||||||
"South Georgia, South Georgia and the South Sandwich Islands"
|
"Bissau, Guinea-Bissau",
|
||||||
]
|
"Dublin, Ireland",
|
||||||
],
|
"Isle of_Man, Isle of Man",
|
||||||
[
|
"Reykjavik, Iceland",
|
||||||
1260,
|
"Jersey, Jersey",
|
||||||
[
|
"Monrovia, Liberia",
|
||||||
"Araguaina, Brazil",
|
"Bamako, Mali",
|
||||||
"Asuncion, Paraguay",
|
"Nouakchott, Mauritania",
|
||||||
"Bahia, Brazil",
|
"Lisbon, Portugal",
|
||||||
"Belem, Brazil",
|
"Madeira, Portugal",
|
||||||
"Buenos Aires, Argentina",
|
"St Helena, Saint Helena, Ascension and Tristan da Cunha",
|
||||||
"Catamarca, Argentina",
|
"Freetown, Sierra Leone",
|
||||||
"Cayenne, French Guiana",
|
"Dakar, Senegal",
|
||||||
"Cordoba, Argentina",
|
"Sao Tome, Sao Tome and Principe",
|
||||||
"Fortaleza, Brazil",
|
"Lome, Togo"
|
||||||
"Jujuy, Argentina",
|
],
|
||||||
"La Rioja, Argentina",
|
"60": [
|
||||||
"Maceio, Brazil",
|
"Andorra, Andorra",
|
||||||
"Mendoza, Argentina",
|
"Tirane, Albania",
|
||||||
"Miquelon, Saint Pierre and Miquelon",
|
"Luanda, Angola",
|
||||||
"Montevideo, Uruguay",
|
"Vienna, Austria",
|
||||||
"Nuuk, Greenland",
|
"Sarajevo, Bosnia and Herzegovina",
|
||||||
"Palmer, Antarctica",
|
"Brussels, Belgium",
|
||||||
"Paramaribo, Suriname",
|
"Porto-Novo, Benin",
|
||||||
"Punta Arenas, Chile",
|
"Kinshasa, Congo, Democratic Republic of the",
|
||||||
"Recife, Brazil",
|
"Bangui, Central African Republic",
|
||||||
"Rio Gallegos, Argentina",
|
"Brazzaville, Congo",
|
||||||
"Rothera, Antarctica",
|
"Zurich, Switzerland",
|
||||||
"Salta, Argentina",
|
"Douala, Cameroon",
|
||||||
"San Juan, Argentina",
|
"Prague, Czechia",
|
||||||
"San Luis, Argentina",
|
"Berlin, Germany",
|
||||||
"Santarem, Brazil",
|
"Busingen, Germany",
|
||||||
"Santiago, Chile",
|
"Copenhagen, Denmark",
|
||||||
"Sao Paulo, Brazil",
|
"Algiers, Algeria",
|
||||||
"Stanley, Falkland Islands (Malvinas)",
|
"El Aaiun, Western Sahara",
|
||||||
"Tucuman, Argentina",
|
"Madrid, Spain",
|
||||||
"Ushuaia, Argentina"
|
"Ceuta, Spain",
|
||||||
]
|
"Paris, France",
|
||||||
],
|
"Libreville, Gabon",
|
||||||
[
|
"Gibraltar, Gibraltar",
|
||||||
1200,
|
"Malabo, Equatorial Guinea",
|
||||||
[
|
"Zagreb, Croatia",
|
||||||
"Anguilla, AI",
|
"Budapest, Hungary",
|
||||||
"Antigua, Antigua and Barbuda",
|
"Rome, Italy",
|
||||||
"Aruba, AW",
|
"Vaduz, Liechtenstein",
|
||||||
"Barbados, BB",
|
"Luxembourg, Luxembourg",
|
||||||
"Bermuda, BM",
|
"Casablanca, Morocco",
|
||||||
"Blanc-Sablon, Canada",
|
"Monaco, Monaco",
|
||||||
"Boa Vista, Brazil",
|
"Podgorica, Montenegro",
|
||||||
"Campo Grande, Brazil",
|
"Skopje, North Macedonia",
|
||||||
"Caracas, Venezuela (Bolivarian Republic of)",
|
"Malta, Malta",
|
||||||
"Cuiaba, Brazil",
|
"Niamey, Niger",
|
||||||
"Curacao, Cura\u00e7ao",
|
"Lagos, Nigeria",
|
||||||
"Dominica, DM",
|
"Amsterdam, Netherlands",
|
||||||
"Glace Bay, Canada",
|
"Oslo, Norway",
|
||||||
"Goose Bay, Canada",
|
"Warsaw, Poland",
|
||||||
"Grenada, GD",
|
"Belgrade, Serbia",
|
||||||
"Guadeloupe, GP",
|
"Stockholm, Sweden",
|
||||||
"Guyana, GY",
|
"Ljubljana, Slovenia",
|
||||||
"Halifax, Canada",
|
"Longyearbyen, Svalbard and Jan Mayen",
|
||||||
"Kralendijk, Bonaire, Sint Eustatius and Saba",
|
"Bratislava, Slovakia",
|
||||||
"La Paz, Bolivia (Plurinational State of)",
|
"San Marino, San Marino",
|
||||||
"Lower Princes, Sint Maarten (Dutch part)",
|
"Ndjamena, Chad",
|
||||||
"Manaus, Brazil",
|
"Tunis, Tunisia",
|
||||||
"Marigot, Saint Martin (French part)",
|
"Vatican, Holy See"
|
||||||
"Martinique, MQ",
|
],
|
||||||
"Moncton, Canada",
|
"120": [
|
||||||
"Montserrat, MS",
|
"Mariehamn, Åland Islands",
|
||||||
"Port of Spain, Trinidad and Tobago",
|
"Sofia, Bulgaria",
|
||||||
"Porto Velho, Brazil",
|
"Bujumbura, Burundi",
|
||||||
"Puerto Rico, PR",
|
"Gaborone, Botswana",
|
||||||
"Santo Domingo, Dominican Republic",
|
"Lubumbashi, Congo, Democratic Republic of the",
|
||||||
"St Barthelemy, Saint Barth\u00e9lemy",
|
"Nicosia, Cyprus",
|
||||||
"St Kitts, Saint Kitts and Nevis",
|
"Famagusta, Cyprus",
|
||||||
"St Lucia, Saint Lucia",
|
"Tallinn, Estonia",
|
||||||
"St Thomas, Virgin Islands (U.S.)",
|
"Cairo, Egypt",
|
||||||
"St Vincent, Saint Vincent and the Grenadines",
|
"Helsinki, Finland",
|
||||||
"Thule, Greenland",
|
"Athens, Greece",
|
||||||
"Tortola, Virgin Islands (British)"
|
"Jerusalem, Israel",
|
||||||
]
|
"Amman, Jordan",
|
||||||
],
|
"Beirut, Lebanon",
|
||||||
[
|
"Maseru, Lesotho",
|
||||||
1140,
|
"Vilnius, Lithuania",
|
||||||
[
|
"Riga, Latvia",
|
||||||
"Atikokan, Canada",
|
"Tripoli, Libya",
|
||||||
"Bogota, Colombia",
|
"Chisinau, Moldova, Republic of",
|
||||||
"Cancun, Mexico",
|
"Blantyre, Malawi",
|
||||||
"Cayman, Cayman Islands",
|
"Maputo, Mozambique",
|
||||||
"Detroit, United States of America",
|
"Windhoek, Namibia",
|
||||||
"Easter, Chile",
|
"Gaza, Palestine, State of",
|
||||||
"Eirunepe, Brazil",
|
"Hebron, Palestine, State of",
|
||||||
"Grand Turk, Turks and Caicos Islands",
|
"Bucharest, Romania",
|
||||||
"Guayaquil, Ecuador",
|
"Kaliningrad, Russian Federation",
|
||||||
"Havana, Cuba",
|
"Kigali, Rwanda",
|
||||||
"Indianapolis, Indiana",
|
"Khartoum, Sudan",
|
||||||
"Iqaluit, Canada",
|
"Juba, South Sudan",
|
||||||
"Jamaica, JM",
|
"Damascus, Syrian Arab Republic",
|
||||||
"Lima, Peru",
|
"Mbabane, Eswatini",
|
||||||
"Louisville, Kentucky",
|
"Kiev, Ukraine",
|
||||||
"Marengo, Indiana",
|
"Uzhgorod, Ukraine",
|
||||||
"Monticello, Kentucky",
|
"Zaporozhye, Ukraine",
|
||||||
"Nassau, Bahamas",
|
"Johannesburg, South Africa",
|
||||||
"New York, United States of America",
|
"Lusaka, Zambia",
|
||||||
"Nipigon, Canada",
|
"Harare, Zimbabwe"
|
||||||
"Panama, PA",
|
],
|
||||||
"Pangnirtung, Canada",
|
"180": [
|
||||||
"Petersburg, Indiana",
|
"Syowa, Antarctica",
|
||||||
"Port-au-Prince, Haiti",
|
"Bahrain, Bahrain",
|
||||||
"Rio Branco, Brazil",
|
"Minsk, Belarus",
|
||||||
"Thunder Bay, Canada",
|
"Djibouti, Djibouti",
|
||||||
"Toronto, Canada",
|
"Asmara, Eritrea",
|
||||||
"Vevay, Indiana",
|
"Addis Ababa, Ethiopia",
|
||||||
"Vincennes, Indiana",
|
"Baghdad, Iraq",
|
||||||
"Winamac, Indiana"
|
"Nairobi, Kenya",
|
||||||
]
|
"Comoro, Comoros",
|
||||||
],
|
"Kuwait, Kuwait",
|
||||||
[
|
"Antananarivo, Madagascar",
|
||||||
1080,
|
"Qatar, Qatar",
|
||||||
[
|
"Moscow, Russian Federation",
|
||||||
"Bahia Banderas, Mexico",
|
"Simferopol, Ukraine",
|
||||||
"Belize, BZ",
|
"Kirov, Russian Federation",
|
||||||
"Beulah, North Dakota",
|
"Volgograd, Russian Federation",
|
||||||
"Center, North Dakota",
|
"Riyadh, Saudi Arabia",
|
||||||
"Chicago, United States of America",
|
"Mogadishu, Somalia",
|
||||||
"Costa Rica, CR",
|
"Istanbul, Turkey",
|
||||||
"El Salvador, SV",
|
"Dar es_Salaam, Tanzania, United Republic of",
|
||||||
"Galapagos, Ecuador",
|
"Kampala, Uganda",
|
||||||
"Guatemala, GT",
|
"Aden, Yemen",
|
||||||
"Knox, Indiana",
|
"Mayotte, Mayotte"
|
||||||
"Managua, Nicaragua",
|
],
|
||||||
"Matamoros, Mexico",
|
"240": [
|
||||||
"Menominee, United States of America",
|
"Dubai, United Arab Emirates",
|
||||||
"Merida, Mexico",
|
"Yerevan, Armenia",
|
||||||
"Mexico City, Mexico",
|
"Baku, Azerbaijan",
|
||||||
"Monterrey, Mexico",
|
"Tbilisi, Georgia",
|
||||||
"New Salem, North Dakota",
|
"Mauritius, Mauritius",
|
||||||
"Rainy River, Canada",
|
"Muscat, Oman",
|
||||||
"Rankin Inlet, Canada",
|
"Reunion, Réunion",
|
||||||
"Regina, Canada",
|
"Astrakhan, Russian Federation",
|
||||||
"Resolute, Canada",
|
"Saratov, Russian Federation",
|
||||||
"Swift Current, Canada",
|
"Ulyanovsk, Russian Federation",
|
||||||
"Tegucigalpa, Honduras",
|
"Samara, Russian Federation",
|
||||||
"Tell City, Indiana",
|
"Mahe, Seychelles"
|
||||||
"Winnipeg, Canada"
|
],
|
||||||
]
|
"300": [
|
||||||
],
|
"Mawson, Antarctica",
|
||||||
[
|
"Qyzylorda, Kazakhstan",
|
||||||
1020,
|
"Aqtobe, Kazakhstan",
|
||||||
[
|
"Aqtau, Kazakhstan",
|
||||||
"Boise, United States of America",
|
"Atyrau, Kazakhstan",
|
||||||
"Cambridge Bay, Canada",
|
"Oral, Kazakhstan",
|
||||||
"Chihuahua, Mexico",
|
"Maldives, Maldives",
|
||||||
"Creston, Canada",
|
"Karachi, Pakistan",
|
||||||
"Dawson Creek, Canada",
|
"Yekaterinburg, Russian Federation",
|
||||||
"Dawson, Canada",
|
"Kerguelen, French Southern Territories",
|
||||||
"Denver, United States of America",
|
"Dushanbe, Tajikistan",
|
||||||
"Edmonton, Canada",
|
"Ashgabat, Turkmenistan",
|
||||||
"Fort Nelson, Canada",
|
"Samarkand, Uzbekistan",
|
||||||
"Hermosillo, Mexico",
|
"Tashkent, Uzbekistan"
|
||||||
"Inuvik, Canada",
|
],
|
||||||
"Mazatlan, Mexico",
|
"360": [
|
||||||
"Ojinaga, Mexico",
|
"Vostok, Antarctica",
|
||||||
"Phoenix, United States of America",
|
"Dhaka, Bangladesh",
|
||||||
"Whitehorse, Canada",
|
"Thimphu, Bhutan",
|
||||||
"Yellowknife, Canada"
|
"Urumqi, China",
|
||||||
]
|
"Chagos, British Indian Ocean Territory",
|
||||||
],
|
"Bishkek, Kyrgyzstan",
|
||||||
[
|
"Almaty, Kazakhstan",
|
||||||
960,
|
"Qostanay, Kazakhstan",
|
||||||
[
|
"Omsk, Russian Federation"
|
||||||
"Los Angeles, United States of America",
|
],
|
||||||
"Pitcairn, PN",
|
"420": [
|
||||||
"Tijuana, Mexico",
|
"Davis, Antarctica",
|
||||||
"Vancouver, Canada"
|
"Christmas, Christmas Island",
|
||||||
]
|
"Jakarta, Indonesia",
|
||||||
],
|
"Pontianak, Indonesia",
|
||||||
[
|
"Phnom Penh, Cambodia",
|
||||||
900,
|
"Vientiane, Lao People's Democratic Republic",
|
||||||
[
|
"Hovd, Mongolia",
|
||||||
"Anchorage, United States of America",
|
"Novosibirsk, Russian Federation",
|
||||||
"Gambier, French Polynesia",
|
"Barnaul, Russian Federation",
|
||||||
"Juneau, United States of America",
|
"Tomsk, Russian Federation",
|
||||||
"Metlakatla, United States of America",
|
"Novokuznetsk, Russian Federation",
|
||||||
"Nome, United States of America",
|
"Krasnoyarsk, Russian Federation",
|
||||||
"Sitka, United States of America",
|
"Bangkok, Thailand",
|
||||||
"Yakutat, United States of America"
|
"Ho Chi_Minh, Viet Nam"
|
||||||
]
|
],
|
||||||
],
|
"480": [
|
||||||
[
|
"Perth, Australia",
|
||||||
840,
|
"Brunei, Brunei Darussalam",
|
||||||
[
|
"Shanghai, China",
|
||||||
"Adak, United States of America",
|
"Hong Kong, Hong Kong",
|
||||||
"Honolulu, United States of America",
|
"Makassar, Indonesia",
|
||||||
"Kiritimati, Kiribati",
|
"Ulaanbaatar, Mongolia",
|
||||||
"Rarotonga, Cook Islands",
|
"Choibalsan, Mongolia",
|
||||||
"Tahiti, French Polynesia"
|
"Macau, Macao",
|
||||||
]
|
"Kuala Lumpur, Malaysia",
|
||||||
],
|
"Kuching, Malaysia",
|
||||||
[
|
"Manila, Philippines",
|
||||||
780,
|
"Irkutsk, Russian Federation",
|
||||||
[
|
"Singapore, Singapore",
|
||||||
"Apia, Samoa",
|
"Taipei, Taiwan, Province of China"
|
||||||
"Auckland, New Zealand",
|
],
|
||||||
"Fakaofo, Tokelau",
|
"540": [
|
||||||
"Kanton, Kiribati",
|
"Jayapura, Indonesia",
|
||||||
"McMurdo, Antarctica",
|
"Tokyo, Japan",
|
||||||
"Midway, United States Minor Outlying Islands",
|
"Pyongyang, Korea (Democratic People's Republic of)",
|
||||||
"Niue, NU",
|
"Seoul, Korea, Republic of",
|
||||||
"Pago Pago, American Samoa",
|
"Palau, Palau",
|
||||||
"Tongatapu, Tonga"
|
"Chita, Russian Federation",
|
||||||
]
|
"Yakutsk, Russian Federation",
|
||||||
],
|
"Khandyga, Russian Federation",
|
||||||
[
|
"Dili, Timor-Leste"
|
||||||
720,
|
],
|
||||||
[
|
"600": [
|
||||||
"Anadyr, Russian Federation",
|
"DumontDUrville, Antarctica",
|
||||||
"Fiji, FJ",
|
"Brisbane, Australia",
|
||||||
"Funafuti, Tuvalu",
|
"Lindeman, Australia",
|
||||||
"Kamchatka, Russian Federation",
|
"Chuuk, Micronesia (Federated States of)",
|
||||||
"Kwajalein, Marshall Islands",
|
"Guam, Guam",
|
||||||
"Majuro, Marshall Islands",
|
"Saipan, Northern Mariana Islands",
|
||||||
"Nauru, NR",
|
"Port Moresby, Papua New Guinea",
|
||||||
"Norfolk, Norfolk Island",
|
"Vladivostok, Russian Federation",
|
||||||
"Tarawa, Kiribati",
|
"Ust-Nera, Russian Federation"
|
||||||
"Wake, United States Minor Outlying Islands",
|
],
|
||||||
"Wallis, Wallis and Futuna"
|
"660": [
|
||||||
]
|
"Casey, Antarctica",
|
||||||
],
|
"Lord Howe, Australia",
|
||||||
[
|
"Macquarie, Australia",
|
||||||
660,
|
"Hobart, Australia",
|
||||||
[
|
"Melbourne, Australia",
|
||||||
"Bougainville, Papua New Guinea",
|
"Sydney, Australia",
|
||||||
"Casey, Antarctica",
|
"Pohnpei, Micronesia (Federated States of)",
|
||||||
"Efate, Vanuatu",
|
"Kosrae, Micronesia (Federated States of)",
|
||||||
"Guadalcanal, Solomon Islands",
|
"Noumea, New Caledonia",
|
||||||
"Hobart, Australia",
|
"Bougainville, Papua New Guinea",
|
||||||
"Kosrae, Micronesia (Federated States of)",
|
"Magadan, Russian Federation",
|
||||||
"Lord Howe, Australia",
|
"Sakhalin, Russian Federation",
|
||||||
"Macquarie, Australia",
|
"Srednekolymsk, Russian Federation",
|
||||||
"Magadan, Russian Federation",
|
"Guadalcanal, Solomon Islands",
|
||||||
"Melbourne, Australia",
|
"Efate, Vanuatu"
|
||||||
"Noumea, New Caledonia",
|
],
|
||||||
"Pohnpei, Micronesia (Federated States of)",
|
"720": [
|
||||||
"Sakhalin, Russian Federation",
|
"Tarawa, Kiribati",
|
||||||
"Srednekolymsk, Russian Federation",
|
"Majuro, Marshall Islands",
|
||||||
"Sydney, Australia"
|
"Kwajalein, Marshall Islands",
|
||||||
]
|
"Norfolk, Norfolk Island",
|
||||||
],
|
"Nauru, Nauru",
|
||||||
[
|
"Kamchatka, Russian Federation",
|
||||||
600,
|
"Anadyr, Russian Federation",
|
||||||
[
|
"Funafuti, Tuvalu",
|
||||||
"Brisbane, Australia",
|
"Wake, United States Minor Outlying Islands",
|
||||||
"Chuuk, Micronesia (Federated States of)",
|
"Wallis, Wallis and Futuna"
|
||||||
"DumontDUrville, Antarctica",
|
],
|
||||||
"Guam, GU",
|
"780": [
|
||||||
"Lindeman, Australia",
|
"McMurdo, Antarctica",
|
||||||
"Port Moresby, Papua New Guinea",
|
"Pago Pago, American Samoa",
|
||||||
"Saipan, Northern Mariana Islands",
|
"Fiji, Fiji",
|
||||||
"Ust-Nera, Russian Federation",
|
"Kanton, Kiribati",
|
||||||
"Vladivostok, Russian Federation"
|
"Niue, Niue",
|
||||||
]
|
"Auckland, New Zealand",
|
||||||
],
|
"Fakaofo, Tokelau",
|
||||||
[
|
"Tongatapu, Tonga",
|
||||||
540,
|
"Midway, United States Minor Outlying Islands",
|
||||||
[
|
"Apia, Samoa"
|
||||||
"Chita, Russian Federation",
|
],
|
||||||
"Dili, Timor-Leste",
|
"840": [
|
||||||
"Jayapura, Indonesia",
|
"Rarotonga, Cook Islands",
|
||||||
"Khandyga, Russian Federation",
|
"Kiritimati, Kiribati",
|
||||||
"Palau, PW",
|
"Tahiti, French Polynesia",
|
||||||
"Pyongyang, Korea (Democratic People's Republic of)",
|
"Adak, United States of America",
|
||||||
"Seoul, Korea, Republic of",
|
"Honolulu, United States of America"
|
||||||
"Tokyo, Japan",
|
],
|
||||||
"Yakutsk, Russian Federation"
|
"900": [
|
||||||
]
|
"Gambier, French Polynesia",
|
||||||
],
|
"Anchorage, United States of America",
|
||||||
[
|
"Juneau, United States of America",
|
||||||
480,
|
"Sitka, United States of America",
|
||||||
[
|
"Metlakatla, United States of America",
|
||||||
"Brunei, Brunei Darussalam",
|
"Yakutat, United States of America",
|
||||||
"Choibalsan, Mongolia",
|
"Nome, United States of America"
|
||||||
"Hong Kong, HK",
|
],
|
||||||
"Irkutsk, Russian Federation",
|
"960": [
|
||||||
"Kuala Lumpur, Malaysia",
|
"Vancouver, Canada",
|
||||||
"Kuching, Malaysia",
|
"Tijuana, Mexico",
|
||||||
"Macau, Macao",
|
"Pitcairn, Pitcairn",
|
||||||
"Makassar, Indonesia",
|
"Los Angeles, United States of America"
|
||||||
"Manila, Philippines",
|
],
|
||||||
"Perth, Australia",
|
"1020": [
|
||||||
"Shanghai, China",
|
"Edmonton, Canada",
|
||||||
"Singapore, SG",
|
"Cambridge Bay, Canada",
|
||||||
"Taipei, Taiwan, Province of China",
|
"Yellowknife, Canada",
|
||||||
"Ulaanbaatar, Mongolia"
|
"Inuvik, Canada",
|
||||||
]
|
"Creston, Canada",
|
||||||
],
|
"Dawson Creek, Canada",
|
||||||
[
|
"Fort Nelson, Canada",
|
||||||
420,
|
"Whitehorse, Canada",
|
||||||
[
|
"Dawson, Canada",
|
||||||
"Bangkok, Thailand",
|
"Mazatlan, Mexico",
|
||||||
"Barnaul, Russian Federation",
|
"Chihuahua, Mexico",
|
||||||
"Christmas, Christmas Island",
|
"Ojinaga, Mexico",
|
||||||
"Davis, Antarctica",
|
"Hermosillo, Mexico",
|
||||||
"Ho Chi Minh, Viet Nam",
|
"Denver, United States of America",
|
||||||
"Hovd, Mongolia",
|
"Boise, United States of America",
|
||||||
"Jakarta, Indonesia",
|
"Phoenix, United States of America"
|
||||||
"Krasnoyarsk, Russian Federation",
|
],
|
||||||
"Novokuznetsk, Russian Federation",
|
"1080": [
|
||||||
"Novosibirsk, Russian Federation",
|
"Belize, Belize",
|
||||||
"Phnom Penh, Cambodia",
|
"Winnipeg, Canada",
|
||||||
"Pontianak, Indonesia",
|
"Rainy River, Canada",
|
||||||
"Tomsk, Russian Federation",
|
"Resolute, Canada",
|
||||||
"Vientiane, Lao People's Democratic Republic"
|
"Rankin Inlet, Canada",
|
||||||
]
|
"Regina, Canada",
|
||||||
],
|
"Swift Current, Canada",
|
||||||
[
|
"Costa Rica, Costa Rica",
|
||||||
360,
|
"Galapagos, Ecuador",
|
||||||
[
|
"Guatemala, Guatemala",
|
||||||
"Almaty, Kazakhstan",
|
"Tegucigalpa, Honduras",
|
||||||
"Bishkek, Kyrgyzstan",
|
"Mexico City, Mexico",
|
||||||
"Chagos, British Indian Ocean Territory",
|
"Merida, Mexico",
|
||||||
"Dhaka, Bangladesh",
|
"Monterrey, Mexico",
|
||||||
"Omsk, Russian Federation",
|
"Matamoros, Mexico",
|
||||||
"Qostanay, Kazakhstan",
|
"Bahia Banderas, Mexico",
|
||||||
"Thimphu, Bhutan",
|
"Managua, Nicaragua",
|
||||||
"Urumqi, China",
|
"El Salvador, El Salvador",
|
||||||
"Vostok, Antarctica"
|
"Chicago, United States of America",
|
||||||
]
|
"Tell City, Indiana",
|
||||||
],
|
"Knox, Indiana",
|
||||||
[
|
"Menominee, United States of America",
|
||||||
300,
|
"Center, North Dakota",
|
||||||
[
|
"New_Salem, North Dakota",
|
||||||
"Aqtau, Kazakhstan",
|
"Beulah, North Dakota"
|
||||||
"Aqtobe, Kazakhstan",
|
],
|
||||||
"Ashgabat, Turkmenistan",
|
"1140": [
|
||||||
"Atyrau, Kazakhstan",
|
"Eirunepe, Brazil",
|
||||||
"Dushanbe, Tajikistan",
|
"Rio Branco, Brazil",
|
||||||
"Karachi, Pakistan",
|
"Nassau, Bahamas",
|
||||||
"Kerguelen, French Southern Territories",
|
"Toronto, Canada",
|
||||||
"Maldives, MV",
|
"Nipigon, Canada",
|
||||||
"Mawson, Antarctica",
|
"Thunder Bay, Canada",
|
||||||
"Oral, Kazakhstan",
|
"Iqaluit, Canada",
|
||||||
"Qyzylorda, Kazakhstan",
|
"Pangnirtung, Canada",
|
||||||
"Samarkand, Uzbekistan",
|
"Atikokan, Canada",
|
||||||
"Tashkent, Uzbekistan",
|
"Easter, Chile",
|
||||||
"Yekaterinburg, Russian Federation"
|
"Bogota, Colombia",
|
||||||
]
|
"Havana, Cuba",
|
||||||
],
|
"Guayaquil, Ecuador",
|
||||||
[
|
"Port-au-Prince, Haiti",
|
||||||
240,
|
"Jamaica, Jamaica",
|
||||||
[
|
"Cayman, Cayman Islands",
|
||||||
"Astrakhan, Russian Federation",
|
"Cancun, Mexico",
|
||||||
"Baku, Azerbaijan",
|
"Panama, Panama",
|
||||||
"Dubai, United Arab Emirates",
|
"Lima, Peru",
|
||||||
"Mahe, Seychelles",
|
"Grand Turk, Turks and Caicos Islands",
|
||||||
"Mauritius, MU",
|
"New York, United States of America",
|
||||||
"Muscat, Oman",
|
"Detroit, United States of America",
|
||||||
"Reunion, R\u00e9union",
|
"Louisville, Kentucky",
|
||||||
"Samara, Russian Federation",
|
"Monticello, Kentucky",
|
||||||
"Saratov, Russian Federation",
|
"Indianapolis, Indiana",
|
||||||
"Tbilisi, Georgia",
|
"Vincennes, Indiana",
|
||||||
"Ulyanovsk, Russian Federation",
|
"Winamac, Indiana",
|
||||||
"Yerevan, Armenia"
|
"Marengo, Indiana",
|
||||||
]
|
"Petersburg, Indiana",
|
||||||
],
|
"Vevay, Indiana"
|
||||||
[
|
],
|
||||||
180,
|
"1200": [
|
||||||
[
|
"Antigua, Antigua and Barbuda",
|
||||||
"Addis Ababa, Ethiopia",
|
"Anguilla, Anguilla",
|
||||||
"Aden, Yemen",
|
"Aruba, Aruba",
|
||||||
"Antananarivo, Madagascar",
|
"Barbados, Barbados",
|
||||||
"Asmara, Eritrea",
|
"St Barthelemy, Saint Barthélemy",
|
||||||
"Baghdad, Iraq",
|
"Bermuda, Bermuda",
|
||||||
"Bahrain, BH",
|
"La Paz, Bolivia (Plurinational State of)",
|
||||||
"Comoro, Comoros",
|
"Kralendijk, Bonaire, Sint Eustatius and Saba",
|
||||||
"Dar es Salaam, Tanzania, United Republic of",
|
"Campo Grande, Brazil",
|
||||||
"Djibouti, DJ",
|
"Cuiaba, Brazil",
|
||||||
"Istanbul, Turkey",
|
"Porto Velho, Brazil",
|
||||||
"Kampala, Uganda",
|
"Boa Vista, Brazil",
|
||||||
"Kirov, Russian Federation",
|
"Manaus, Brazil",
|
||||||
"Kuwait, KW",
|
"Halifax, Canada",
|
||||||
"Mayotte, YT",
|
"Glace Bay, Canada",
|
||||||
"Minsk, Belarus",
|
"Moncton, Canada",
|
||||||
"Mogadishu, Somalia",
|
"Goose Bay, Canada",
|
||||||
"Moscow, Russian Federation",
|
"Blanc-Sablon, Canada",
|
||||||
"Nairobi, Kenya",
|
"Curacao, Curaçao",
|
||||||
"Qatar, QA",
|
"Dominica, Dominica",
|
||||||
"Riyadh, Saudi Arabia",
|
"Santo Domingo, Dominican Republic",
|
||||||
"Simferopol, Ukraine",
|
"Grenada, Grenada",
|
||||||
"Syowa, Antarctica",
|
"Thule, Greenland",
|
||||||
"Volgograd, Russian Federation"
|
"Guadeloupe, Guadeloupe",
|
||||||
]
|
"Guyana, Guyana",
|
||||||
],
|
"St Kitts, Saint Kitts and Nevis",
|
||||||
[
|
"St Lucia, Saint Lucia",
|
||||||
120,
|
"Marigot, Saint Martin (French part)",
|
||||||
[
|
"Martinique, Martinique",
|
||||||
"Amman, Jordan",
|
"Montserrat, Montserrat",
|
||||||
"Athens, Greece",
|
"Puerto Rico, Puerto Rico",
|
||||||
"Beirut, Lebanon",
|
"Lower Princes, Sint Maarten (Dutch part)",
|
||||||
"Blantyre, Malawi",
|
"Port of_Spain, Trinidad and Tobago",
|
||||||
"Bucharest, Romania",
|
"St Vincent, Saint Vincent and the Grenadines",
|
||||||
"Bujumbura, Burundi",
|
"Caracas, Venezuela (Bolivarian Republic of)",
|
||||||
"Cairo, Egypt",
|
"Tortola, Virgin Islands (British)",
|
||||||
"Chisinau, Moldova, Republic of",
|
"St Thomas, Virgin Islands (U.S.)"
|
||||||
"Damascus, Syrian Arab Republic",
|
],
|
||||||
"Famagusta, Cyprus",
|
"1260": [
|
||||||
"Gaborone, Botswana",
|
"Palmer, Antarctica",
|
||||||
"Gaza, Palestine, State of",
|
"Rothera, Antarctica",
|
||||||
"Harare, Zimbabwe",
|
"Buenos Aires, Argentina",
|
||||||
"Hebron, Palestine, State of",
|
"Cordoba, Argentina",
|
||||||
"Helsinki, Finland",
|
"Salta, Argentina",
|
||||||
"Jerusalem, Israel",
|
"Jujuy, Argentina",
|
||||||
"Johannesburg, South Africa",
|
"Tucuman, Argentina",
|
||||||
"Juba, South Sudan",
|
"Catamarca, Argentina",
|
||||||
"Kaliningrad, Russian Federation",
|
"La Rioja, Argentina",
|
||||||
"Khartoum, Sudan",
|
"San Juan, Argentina",
|
||||||
"Kiev, Ukraine",
|
"Mendoza, Argentina",
|
||||||
"Kigali, Rwanda",
|
"San Luis, Argentina",
|
||||||
"Lubumbashi, Congo, Democratic Republic of the",
|
"Rio Gallegos, Argentina",
|
||||||
"Lusaka, Zambia",
|
"Ushuaia, Argentina",
|
||||||
"Maputo, Mozambique",
|
"Belem, Brazil",
|
||||||
"Mariehamn, \u00c5land Islands",
|
"Fortaleza, Brazil",
|
||||||
"Maseru, Lesotho",
|
"Recife, Brazil",
|
||||||
"Mbabane, Eswatini",
|
"Araguaina, Brazil",
|
||||||
"Nicosia, Cyprus",
|
"Maceio, Brazil",
|
||||||
"Riga, Latvia",
|
"Bahia, Brazil",
|
||||||
"Sofia, Bulgaria",
|
"Sao Paulo, Brazil",
|
||||||
"Tallinn, Estonia",
|
"Santarem, Brazil",
|
||||||
"Tripoli, Libya",
|
"Santiago, Chile",
|
||||||
"Uzhgorod, Ukraine",
|
"Punta Arenas, Chile",
|
||||||
"Vilnius, Lithuania",
|
"Stanley, Falkland Islands (Malvinas)",
|
||||||
"Windhoek, Namibia",
|
"Cayenne, French Guiana",
|
||||||
"Zaporozhye, Ukraine"
|
"Nuuk, Greenland",
|
||||||
]
|
"Miquelon, Saint Pierre and Miquelon",
|
||||||
],
|
"Asuncion, Paraguay",
|
||||||
[
|
"Paramaribo, Suriname",
|
||||||
60,
|
"Montevideo, Uruguay"
|
||||||
[
|
],
|
||||||
"Algiers, Algeria",
|
"1320": [
|
||||||
"Amsterdam, Netherlands",
|
"Noronha, Brazil",
|
||||||
"Andorra, AD",
|
"South Georgia, South Georgia and the South Sandwich Islands"
|
||||||
"Bangui, Central African Republic",
|
],
|
||||||
"Belgrade, Serbia",
|
"1380": [
|
||||||
"Berlin, Germany",
|
"Cape Verde, Cabo Verde",
|
||||||
"Bratislava, Slovakia",
|
"Scoresbysund, Greenland",
|
||||||
"Brazzaville, Congo",
|
"Azores, Portugal"
|
||||||
"Brussels, Belgium",
|
]
|
||||||
"Budapest, Hungary",
|
}
|
||||||
"Busingen, Germany",
|
|
||||||
"Casablanca, Morocco",
|
|
||||||
"Ceuta, Spain",
|
|
||||||
"Copenhagen, Denmark",
|
|
||||||
"Douala, Cameroon",
|
|
||||||
"El Aaiun, Western Sahara",
|
|
||||||
"Gibraltar, GI",
|
|
||||||
"Kinshasa, Congo, Democratic Republic of the",
|
|
||||||
"Lagos, Nigeria",
|
|
||||||
"Libreville, Gabon",
|
|
||||||
"Ljubljana, Slovenia",
|
|
||||||
"Longyearbyen, Svalbard and Jan Mayen",
|
|
||||||
"Luanda, Angola",
|
|
||||||
"Luxembourg, LU",
|
|
||||||
"Madrid, Spain",
|
|
||||||
"Malabo, Equatorial Guinea",
|
|
||||||
"Malta, MT",
|
|
||||||
"Monaco, MC",
|
|
||||||
"Ndjamena, Chad",
|
|
||||||
"Niamey, Niger",
|
|
||||||
"Oslo, Norway",
|
|
||||||
"Paris, France",
|
|
||||||
"Podgorica, Montenegro",
|
|
||||||
"Porto-Novo, Benin",
|
|
||||||
"Prague, Czechia",
|
|
||||||
"Rome, Italy",
|
|
||||||
"San Marino, SM",
|
|
||||||
"Sarajevo, Bosnia and Herzegovina",
|
|
||||||
"Skopje, North Macedonia",
|
|
||||||
"Stockholm, Sweden",
|
|
||||||
"Tirane, Albania",
|
|
||||||
"Tunis, Tunisia",
|
|
||||||
"Vaduz, Liechtenstein",
|
|
||||||
"Vatican, Holy See",
|
|
||||||
"Vienna, Austria",
|
|
||||||
"Warsaw, Poland",
|
|
||||||
"Zagreb, Croatia",
|
|
||||||
"Zurich, Switzerland"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
[
|
|
||||||
"Abidjan, C\u00f4te d'Ivoire",
|
|
||||||
"Accra, Ghana",
|
|
||||||
"Bamako, Mali",
|
|
||||||
"Banjul, Gambia",
|
|
||||||
"Bissau, Guinea-Bissau",
|
|
||||||
"Canary, Spain",
|
|
||||||
"Conakry, Guinea",
|
|
||||||
"Dakar, Senegal",
|
|
||||||
"Danmarkshavn, Greenland",
|
|
||||||
"Dublin, Ireland",
|
|
||||||
"Faroe, Faroe Islands",
|
|
||||||
"Freetown, Sierra Leone",
|
|
||||||
"Guernsey, GG",
|
|
||||||
"Isle of Man, IM",
|
|
||||||
"Jersey, JE",
|
|
||||||
"Lisbon, Portugal",
|
|
||||||
"Lome, Togo",
|
|
||||||
"London, United Kingdom of Great Britain and Northern Ireland",
|
|
||||||
"Madeira, Portugal",
|
|
||||||
"Monrovia, Liberia",
|
|
||||||
"Nouakchott, Mauritania",
|
|
||||||
"Ouagadougou, Burkina Faso",
|
|
||||||
"Reykjavik, Iceland",
|
|
||||||
"Sao Tome, Sao Tome and Principe",
|
|
||||||
"St Helena, Saint Helena, Ascension and Tristan da Cunha",
|
|
||||||
"Troll, Antarctica"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
let fs = require('fs');
|
||||||
|
let csv = require('csv');
|
||||||
|
|
||||||
|
let countries = {},
|
||||||
|
zones = {},
|
||||||
|
offsdict = {},
|
||||||
|
now = Date.now(); // we need this to find zone's current DST state
|
||||||
|
|
||||||
|
function handleWrite(err,bytes) {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing to file ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Generating fourTwentyTz.js...");
|
||||||
|
fs.createReadStream(__dirname+'/country.csv')
|
||||||
|
.pipe(csv.parse())
|
||||||
|
.on('data', (r) => {
|
||||||
|
countries[r[0]] = r[1];
|
||||||
|
})
|
||||||
|
.on('end', () => {
|
||||||
|
fs.createReadStream(__dirname+'/zone.csv')
|
||||||
|
.pipe(csv.parse())
|
||||||
|
.on('data', (r) => {
|
||||||
|
let parts = r[2].replace('_',' ').split('/');
|
||||||
|
let city = parts[parts.length-1];
|
||||||
|
let country ='';
|
||||||
|
if (parts.length>2) { // e.g. America/North_Dakota/New_Salem
|
||||||
|
country = parts[1]; // e.g. North Dakota
|
||||||
|
} else {
|
||||||
|
country = countries[r[1]]; // e.g. United States
|
||||||
|
}
|
||||||
|
zones[parseInt(r[0])] = {"name": `${city}, ${country}`};
|
||||||
|
})
|
||||||
|
.on('end', () => {
|
||||||
|
fs.createReadStream(__dirname+'/timezone.csv')
|
||||||
|
.pipe(csv.parse())
|
||||||
|
.on('data', (r) => {
|
||||||
|
code = parseInt(r[0]);
|
||||||
|
if (!(code in zones)) return;
|
||||||
|
starttime = parseInt(r[2] || "0"); // Bugger. They're feeding us blanks for UTC now
|
||||||
|
offs = parseInt(r[3]);
|
||||||
|
if (offs<0) {
|
||||||
|
offs += 60*60*24;
|
||||||
|
}
|
||||||
|
zone = zones[code];
|
||||||
|
if (starttime<now && (!("starttime" in zone) || zone.starttime<starttime)) {
|
||||||
|
zone.starttime = starttime;
|
||||||
|
zone.offs = Math.floor(offs/60);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('end', () => {
|
||||||
|
for (z in zones) {
|
||||||
|
zone = zones[z];
|
||||||
|
if (zone.offs%60) continue; // One a dem funky timezones. Ignore.
|
||||||
|
zonelist = offsdict[zone.offs] || [];
|
||||||
|
zonelist.push(zone.name);
|
||||||
|
offsdict[zone.offs] = zonelist;
|
||||||
|
}
|
||||||
|
fs.open("fourTwentyTz.js","w", (err, fd) => {
|
||||||
|
if (err) {
|
||||||
|
console.log("Can't open output file");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.write(fd, "// Generated by mkFourTwentyTz.js\n", handleWrite);
|
||||||
|
fs.write(fd, `// ${Date()}\n`, handleWrite);
|
||||||
|
fs.write(fd, "// Data source: https://timezonedb.com/files/timezonedb.csv.zip\n", handleWrite);
|
||||||
|
fs.write(fd, "exports.timezones = ", handleWrite);
|
||||||
|
fs.write(fd, JSON.stringify(offsdict, null, 4), handleWrite);
|
||||||
|
console.log('Done.');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
# Generates fourTwentyTz.js from time zone csv files
|
|
||||||
# get latest files from https://timezonedb.com/download
|
|
||||||
import csv,json,time,os,math
|
|
||||||
countries = {}
|
|
||||||
for r in csv.reader(open("country.csv")):
|
|
||||||
countries[r[0]] = r[1]
|
|
||||||
zones = {}
|
|
||||||
for r in csv.reader(open("zone.csv")):
|
|
||||||
parts = r[2].replace('_',' ').split('/')
|
|
||||||
city = parts[-1]
|
|
||||||
if len(parts)>2: # e.g. America/North_Dakota/New_Salem
|
|
||||||
country = parts[1] # e.g. North Dakota
|
|
||||||
else: # e.g. America/Denver
|
|
||||||
country = countries[r[1]] # e.g. United States
|
|
||||||
if country==city: # Avoid awkward searches like "Anguilla, Anguilla"
|
|
||||||
country = r[1] # Use code instead
|
|
||||||
zones[int(r[0])] = {"name":', '.join((city,country))}
|
|
||||||
now = int(time.time())
|
|
||||||
for r in csv.reader(open("timezone.csv")):
|
|
||||||
code = int(r[0])
|
|
||||||
if code not in zones:
|
|
||||||
continue
|
|
||||||
starttime = int(r[2] or "0") # Bugger. They're feeding us blanks for UTC now
|
|
||||||
offs = int(r[3])
|
|
||||||
if offs < 0:
|
|
||||||
offs += 60*60*24
|
|
||||||
d = zones[code]
|
|
||||||
if starttime<now and ("starttime" not in d or d["starttime"]<starttime):
|
|
||||||
d["starttime"] = starttime
|
|
||||||
d["offs"] = math.floor(offs/60)
|
|
||||||
offsdict = {}
|
|
||||||
for k in zones:
|
|
||||||
d = zones[k]
|
|
||||||
if d["offs"]%60: # One a dem funky timezone. Ignore.
|
|
||||||
continue
|
|
||||||
offsdict[d["offs"]] = offsdict.get(d["offs"],[])+[d["name"]]
|
|
||||||
res = sorted([[k,sorted(offsdict[k])] for k in offsdict],key=lambda x:-x[0])
|
|
||||||
js = open("fourTwentyTz.js","w")
|
|
||||||
js.write("// Generated by mk420tz.py - see https://github.com/thedod/BangleApps/420clock\n")
|
|
||||||
js.write("// (version: {0})\n".format(time.ctime(time.time())))
|
|
||||||
js.write("// Data source: https://timezonedb.com/files/timezonedb.csv.zip\n")
|
|
||||||
js.write("// (version: {0})\n".format(time.ctime(os.stat("zone.csv").st_mtime)))
|
|
||||||
js.write("exports.timezones = ")
|
|
||||||
json.dump(res,js,indent=1)
|
|
||||||
js.write(";\n")
|
|
||||||
js.close()
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "mkfourtwentytz",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Convert timezonedb.com CSV to fourTwentyTz.js for BangleJS ftclock app",
|
||||||
|
"main": "mkFourTwentyTz.js",
|
||||||
|
"scripts": {
|
||||||
|
"make": "node mkFourTwentyTz.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"dependencies": {
|
||||||
|
"csv": "^6.0.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue