SBECK-github / Date-Manip

Other
10 stars 11 forks source link

missing windows timezone aliases #46

Closed datamuc closed 1 year ago

datamuc commented 1 year ago

Hi,

on a finish machine the timezone is "FLE Standard Time". Date::Manip didn't like that. It looks like there are some aliases defined in Date::Manip::Zones. I created a list with tzutil /l of all the timezones windows knows of. Here is a list of missing aliases:


danielt@lehn:~/vc/git/Date-Manip ‹master› 
$ (while IFS= read line ; do fgrep -qi "$line" lib/Date/Manip/Zones.pm || echo "$line"; done < ~/tmp/tzutil.txt ) > missing.txt
danielt@lehn:~/vc/git/Date-Manip ‹master› 
$ sort missing.txt 
aleutian standard time
altai standard time
astrakhan standard time
aus central w. standard time
belarus standard time
bougainville standard time
chatham islands standard time
cuba standard time
easter island standard time
eastern standard time (mexico)
fle standard time
greenwich standard time
haiti standard time
libya standard time
line islands standard time
lord howe standard time
magallanes standard time
marquesas standard time
norfolk standard time
north korea standard time
omsk standard time
pacific standard time (mexico)
qyzylorda standard time
saint pierre standard time
sakhalin standard time
sao tome standard time
saratov standard time
south sudan standard time
sudan standard time
tocantins standard time
tomsk standard time
transbaikal standard time
turks and caicos standard time
volgograd standard time
w. mongolia standard time
west bank standard time
yukon standard time
datamuc commented 1 year ago
$ git diff
diff --git a/lib/Date/Manip/Zones.pm b/lib/Date/Manip/Zones.pm
index c9987673..b7443e49 100644
--- a/lib/Date/Manip/Zones.pm
+++ b/lib/Date/Manip/Zones.pm
@@ -789,6 +789,43 @@ $LastYear      = '2093';
 );

 %Alias = (
+  'aleutian standard time'             => 'pacific/honolulu',
+  'altai standard time'                => 'asia/krasnoyarsk',
+  'astrakhan standard time'            => 'europe/samara',
+  'aus central w. standard time'       => 'australia/eucla',
+  'belarus standard time'              => 'europe/minsk',
+  'bougainville standard time'         => 'pacific/bougainville',
+  'chatham islands standard time'      => 'pacific/chatham',
+  'cuba standard time'                 => 'america/havana',
+  'easter island standard time'        => 'pacific/easter',
+  'eastern standard time (mexico)'     => 'america/cancun', # ?
+  'fle standard time'                  => 'europe/helsinki',
+  'greenwich standard time'            => 'etc/gmt',
+  'haiti standard time'                => 'america/port-au-prince',
+  'libya standard time'                => 'africa/tripoli',
+  'line islands standard time'         => 'pacific/kiritimati',
+  'lord howe standard time'            => 'australia/lord_howe',
+  'magallanes standard time'           => 'america/punta_arenas',
+  'marquesas standard time'            => 'pacific/marquesas',
+  'norfolk standard time'              => 'pacific/norfolk',
+  'north korea standard time'          => 'asia/pyongyang',
+  'omsk standard time'                 => 'asia/omsk',
+  'pacific standard time (mexico)'     => 'america/tijuana', # ?
+  'qyzylorda standard time'            => 'asia/qyzylorda',
+  'saint pierre standard time'         => 'america/miquelon',
+  'sakhalin standard time'             => 'asia/sakhalin',
+  'sao tome standard time'             => 'africa/sao_tome',
+  'saratov standard time'              => 'europe/saratov',
+  'south sudan standard time'          => 'africa/juba',
+  'sudan standard time'                => 'africa/khartoum',
+  'tocantins standard time'            => 'america/araguaina',
+  'tomsk standard time'                => 'asia/tomsk',
+  'transbaikal standard time'          => 'asia/yakutsk',
+  #'turks and caicos standard time'     => 'FIXME',
+  'volgograd standard time'            => 'europe/volgograd',
+  'w. mongolia standard time'          => 'asia/ulaanbaatar',
+  #'west bank standard time'            => 'FIXME',
+  'yukon standard time'                => 'canada/yukon',
   'a'                                  => 'a',
   'africa/abidjan'                     => 'africa/abidjan',
   'africa/algiers'                     => 'africa/algiers',

Couldn't find a proper aliases for the FIXME ones. The lines marked with a question mark are educated guesses. But %Alias needs a cleanup, it's not properly sorted, and a lot of stuff is duplicated in it. like 'america/nassau' for example.

SBECK-github commented 1 year ago

Okay, so clearly I hadn't updated the windows timezones in a while... my data source was old and not being updated. So... time to add all these. A couple of notes though.

First off, I don't want to rely on running tzutil on a windows box (since I don't even run windows). Second, if I did, I'd have to determine what zone was being referred to (which as you've found is non-trivial. I found a list of windows timezones (which seems to be being actively updated) at:

https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml

Parsing this (which I will do each release going forward) gave me a list of timezones to add, and they do the work of determining the zone to use. For the most part, their zones agree with what you sent, but a few do differ from what you said including:

"Aleutian Standard Time" => "America/Adak", "Altai Standard Time" => "Asia/Barnaul", "Astrakhan Standard Time" => "Europe/Astrakhan", "FLE Standard Time" => "Europe/Kiev", "Greenwich Standard Time" => "Atlantic/Reykjavik", "Transbaikal Standard Time" => "Asia/Chita", "W. Mongolia Standard Time" => "Asia/Hovd", "Yukon Standard Time" => "America/Whitehorse",

Thanks for pointing this out to me though. I really appreciate it.

Given the number of missing zones, I may do an immediate release (undecided yet). Otherwise, these zones will be fixed in the next regular release (Dec 1).

lgmu commented 1 year ago

Hi, thanks for your reply and working on it.

It would be great to have a release before december.