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

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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@philr

philr Jul 28, 2016

Member

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 }
Member

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