{"action":"closed","issue":{"url":"https://api.github.com/repos/rails/rails/issues/25428","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/25428/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/25428/comments","events_url":"https://api.github.com/repos/rails/rails/issues/25428/events","html_url":"https://github.com/rails/rails/issues/25428","id":160999379,"number":25428,"title":"Date#to_time doesn't respect Time#use_zone","user":{"login":"Dbz","id":628429,"avatar_url":"https://avatars.githubusercontent.com/u/628429?v=3","gravatar_id":"","url":"https://api.github.com/users/Dbz","html_url":"https://github.com/Dbz","followers_url":"https://api.github.com/users/Dbz/followers","following_url":"https://api.github.com/users/Dbz/following{/other_user}","gists_url":"https://api.github.com/users/Dbz/gists{/gist_id}","starred_url":"https://api.github.com/users/Dbz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dbz/subscriptions","organizations_url":"https://api.github.com/users/Dbz/orgs","repos_url":"https://api.github.com/users/Dbz/repos","events_url":"https://api.github.com/users/Dbz/events{/privacy}","received_events_url":"https://api.github.com/users/Dbz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activesupport","name":"activesupport","color":"FC9300"},{"url":"https://api.github.com/repos/rails/rails/labels/With%20reproduction%20steps","name":"With reproduction steps","color":"009800"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-06-18T01:06:04Z","updated_at":"2016-07-01T08:54:26Z","closed_at":"2016-07-01T08:54:26Z","body":"### Steps to reproduce\r\n```Ruby\r\n# System clock should be in PDT\r\nTime.use_zone('Eastern Time (US & Canada)') do\r\n  d = Date.parse('friday')\r\n  puts d.to_time\r\n  puts d.to_time.zone\r\n\r\n  t = Time.zone.parse('friday')\r\n  puts t\r\n  puts t.zone\r\nend\r\n```\r\n\r\n### Expected behavior\r\n> 2016-06-17 00:00:00 -0400\r\n> EDT\r\n> 2016-06-17 00:00:00 -0400\r\n> EDT\r\n\r\n### Actual behavior\r\n> 2016-06-17 00:00:00 -0700\r\n> PDT\r\n> 2016-06-17 00:00:00 -0400\r\n> EDT\r\n\r\n### System configuration\r\n**Rails version**: Rails 4.2.3\r\n\r\n**Ruby version**: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin14.1.0]\r\n\r\n### Code Fix\r\nIn: [date conversions](https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date/conversions.rb#L73-L85)\r\n```Ruby\r\ndef to_time(form = :local)\r\n  raise ArgumentError, \"Expected :local or :utc, got #{form.inspect}.\" unless [:local, :utc].include?(form)\r\n  ::Time.zone.send(form, year, month, day) # Time.zone.send instead of Time.zone\r\nend\r\n```"}}
{"actor":{"display_login":"pixeltrix"}}