tzc
tzc copied to clipboard
Invalid conversion: tzc-convert-time EDT 23:00 => IST 23:00, which is wrong.
Hi,
I just downloaded this package and tried to convert between EDT (Easter Daylight Time) 23:00 to IST (India Standard Time) and the result was that they are equal, which is wrong.
Tested on Emacs 27.1 Here's a IELM session:
ELISP> (require 'tzc)
tzc
ELISP> (tzc-convert-time "23:00" "EDT" "IST")
#("23:00 EDT = 23:00 IST" 0 5
(face tzc-face-time-string)
6 9
(face tzc-face-time-zone-label)
12 17
(face tzc-face-time-string)
18 21
(face tzc-face-time-zone-label))
ELISP>
Trying EST (Eastern Standard Time) did not work either:
ELISP> (tzc-convert-time "23:00" "EST" "IST")
#("23:00 EST = 04:00 +1D IST" 0 5
(face tzc-face-time-string)
6 9
(face tzc-face-time-zone-label)
12 17
(face tzc-face-time-string)
17 21
(face tzc-face-date-string)
22 25
(face tzc-face-time-zone-label))
ELISP>
23:00 EDT is 08:30 IST.
Hi, thanks for reaching out. tzc does not support timezone abbreviations like, EST or EDT since these are not unambiguous, instead it uses the city and area-based names like America/New_york for EST. In the above example, if you use
(tzc-convert-time "23:00" "America/New_york" "Asia/Kolkata")
you will get the correct result. This has the advantage that it takes care of daylight saving.
if you frequently need to convert time between two zones, you may want to set up your favourite time zones following this https://github.com/md-arif-shaikh/tzc#customization and then call tzc-convert-time-to-favourite-time-zones
Ah, thanks, good to know. I wonder if the code could detect the unsupported timezone abbreviations and issue a user-error when those are passed.