{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/20504","labels_url":"https://api.github.com/repos/rails/rails/issues/20504/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/20504/comments","events_url":"https://api.github.com/repos/rails/rails/issues/20504/events","html_url":"https://github.com/rails/rails/issues/20504","id":86992220,"number":20504,"title":"Buggy Timezone from offset","user":{"login":"brauliobo","id":41740,"avatar_url":"https://avatars.githubusercontent.com/u/41740?v=3","gravatar_id":"","url":"https://api.github.com/users/brauliobo","html_url":"https://github.com/brauliobo","followers_url":"https://api.github.com/users/brauliobo/followers","following_url":"https://api.github.com/users/brauliobo/following{/other_user}","gists_url":"https://api.github.com/users/brauliobo/gists{/gist_id}","starred_url":"https://api.github.com/users/brauliobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brauliobo/subscriptions","organizations_url":"https://api.github.com/users/brauliobo/orgs","repos_url":"https://api.github.com/users/brauliobo/repos","events_url":"https://api.github.com/users/brauliobo/events{/privacy}","received_events_url":"https://api.github.com/users/brauliobo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-10T14:38:51Z","updated_at":"2015-06-10T20:35:21Z","closed_at":"2015-06-10T17:07:41Z","body":"Detected on this case, there might be others\r\n```\r\n2.1.5 :001 > Time.zone = ActiveSupport::TimeZone[-4]\r\nT => #<ActiveSupport::TimeZone:0x00000005b01b20 @name=\"Atlantic Time (Canada)\", @utc_offset=nil, @tzinfo=#<TZInfo::TimezoneProxy: America/Halifax>, @current_period=#<TZInfo::TimezonePeriod: #<TZInfo::TimezoneTransitionDefinition: #<TZInfo::TimeOrDateTime: 1425794400>,#<TZInfo::TimezoneOffset: -14400,3600,ADT>>,#<TZInfo::TimezoneTransitionDefinition: #<TZInfo::TimeOrDateTime: 1446354000>,#<TZInfo::TimezoneOffset: -14400,0,AST>>>> \r\n2.1.5 :002 > Time.zone.now\r\n => Wed, 10 Jun 2015 11:35:35 ADT -03:00 \r\n```\r\nTested on Rails 3.2.21 and 4.2.0"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/110904676","html_url":"https://github.com/rails/rails/issues/20504#issuecomment-110904676","issue_url":"https://api.github.com/repos/rails/rails/issues/20504","id":110904676,"user":{"login":"matthewd","id":1034,"avatar_url":"https://avatars.githubusercontent.com/u/1034?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewd","html_url":"https://github.com/matthewd","followers_url":"https://api.github.com/users/matthewd/followers","following_url":"https://api.github.com/users/matthewd/following{/other_user}","gists_url":"https://api.github.com/users/matthewd/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewd/subscriptions","organizations_url":"https://api.github.com/users/matthewd/orgs","repos_url":"https://api.github.com/users/matthewd/repos","events_url":"https://api.github.com/users/matthewd/events{/privacy}","received_events_url":"https://api.github.com/users/matthewd/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T20:35:21Z","updated_at":"2015-06-10T20:35:21Z","body":"> It is quite strange that [..] the API should give the most common TZ.\r\n\r\nThat's just luck. Or maybe a property of the order the TZs are defined by the OS. We certainly make no effort to favour any particular TZ for a given offset. \r\n\r\n> Besides the Etc/UTC+N and Etc/GMT+N is part of the OS's TZ.\r\n\r\nMaybe on your OS. (To be clear: I believe you. They're defined by mine too. But not all.)\r\n\r\n> So still I can't understand why from a given offset the API should arbitrarily choose a timezone from tens of timezones that match the offset.\r\n\r\nI agree that's a silly thing for it to do... but that's what it's being asked for, so it doesn't have much choice. There is, by definition, no \"correct\" TZ for a given UTC offset. #19279 is attempting to improve our guess, but ultimately, if you intend to manipulate the resulting timestamp, you're gonna have a bad time (no pun intended... but that too).\r\n\r\n... unless you happen to be working in a non-DST-observing region. But then, if you're prepared to force that assumption upon your application, you clearly have a specific location in mind, and you might as well just give it the actual TZ. "}}