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

'CEST' causes TZInfo::InvalidTimezoneIdentifier: Invalid identifier #53

Closed
wueb opened this issue Jul 28, 2016 · 1 comment
Closed

'CEST' causes TZInfo::InvalidTimezoneIdentifier: Invalid identifier #53

wueb opened this issue Jul 28, 2016 · 1 comment
Labels

Comments

@wueb
Copy link

@wueb wueb commented Jul 28, 2016

Time.now.getlocal.zone returns 'CEST' on my system.
This leads to an error when calling TZInfo::Timezone.get(Time.now.getlocal.zone).

Maybe you should add CEST to the list of timezones.

Reproduce with TZInfo::Timezone.get('CEST')
About CEST: http://www.timeanddate.com/time/zones/cest

I am using tzinfo version 1.2.2

@philr
Copy link
Member

@philr philr commented Jul 28, 2016

TZInfo only supports (and will only ever support) time zone identifiers that are included in the IANA Time Zone Database. CEST is not a valid Time Zone Database identifier, so you will get a TZInfo::InvalidTimezoneIdentifier exception raised if you try and use it.

The IANA Time Zone Database doesn't use abbreviations as identifiers because they are frequently ambiguous. Abbreviations also change twice per year in time zones that observe daylight savings time in summer.

You can use the following code to return all the time zones that are currently using CEST as an abbreviation:

TZInfo::Timezone.all.find_all {|tz| tz.current_period.abbreviation == :CEST }
@philr philr added the invalid label Jul 28, 2016
@philr philr closed this Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.