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

Wrong UTC Offset for "Etc/GMT-12" #69

Closed
mrj opened this issue Jul 11, 2017 · 2 comments
Closed

Wrong UTC Offset for "Etc/GMT-12" #69

mrj opened this issue Jul 11, 2017 · 2 comments
Labels

Comments

@mrj
Copy link

mrj commented Jul 11, 2017

require 'tzinfo'
TZInfo::Timezone.get('Etc/GMT-12').current_period

=> #<TZInfo::TimezonePeriod: nil,nil,#<TZInfo::TimezoneOffset: 43200,0,+12>>>

GMT-12 is a useful "Anywhere on Earth" zone.

@philr
Copy link
Member

philr commented Jul 11, 2017

An offset of +12 hours is the correct result for the Etc/GMT-12 zone.

TZInfo uses the data from the IANA Time Zone database. This defines the Etc/GMT[+-]n zones in a POSIX-compliant (but unexpected) manner. From the etcetera file in the database:

Be consistent with POSIX TZ settings in the Zone names even though this is the opposite of what many people expect. POSIX has positive signs west of Greenwich, but many people expect positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses the abbreviation "-04" and corresponds to 4 hours behind UT (i.e. west of Greenwich) even though many people would expect it to mean 4 hours ahead of UT (i.e. east of Greenwich).

@philr philr added the invalid label Jul 11, 2017
@philr philr closed this as completed Jul 11, 2017
@mrj
Copy link
Author

mrj commented Jul 11, 2017

OK. I've now got to work out why this zone is coming up in ActiveSupport::TimeZone as GMT+12, adjacent to Auckland, rather than at the top before American Samoa.

EDIT: Ah, I use GMT+12 for Anywhere on Earth. Thanks.

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

No branches or pull requests

2 participants