Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid conversion: tzc-convert-time EDT 23:00 => IST 23:00, which is wrong. #4

Open
pierre-rouleau opened this issue Apr 12, 2022 · 2 comments

Comments

@pierre-rouleau
Copy link

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.

@pierre-rouleau pierre-rouleau changed the title tzc-convert-time edt 23:00 = IST 23:00 Invalid conversion: tzc-convert-time EDT 23:00 => IST 23:00, which is wrong. Apr 12, 2022
@md-arif-shaikh
Copy link
Owner

md-arif-shaikh commented Apr 12, 2022

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

@pierre-rouleau
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants