diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-02-10 18:45:55 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-02-10 18:45:55 +0000 |
commit | db4fc6f206f83d8981e006c80f08bfd4bff02e87 (patch) | |
tree | e044ae9fdbca5c236c541b005e2401763c0ad126 /activesupport/lib/active_support/core_ext | |
parent | 521714a39d2f74f6a7e617db68f8fafc93a425a0 (diff) | |
download | rails-db4fc6f206f83d8981e006c80f08bfd4bff02e87.tar.gz rails-db4fc6f206f83d8981e006c80f08bfd4bff02e87.tar.bz2 rails-db4fc6f206f83d8981e006c80f08bfd4bff02e87.zip |
Time#in_time_zone handles Time.local instances correctly
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8849 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/zones.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb index 4705e93f27..18af28edc8 100644 --- a/activesupport/lib/active_support/core_ext/time/zones.rb +++ b/activesupport/lib/active_support/core_ext/time/zones.rb @@ -42,15 +42,13 @@ module ActiveSupport #:nodoc: end end - # Returns the simultaneous time in the supplied zone. self is assumed to be in UTC regardless of constructor. - # - # Examples: + # Returns the simultaneous time in the supplied zone. Examples: # # t = Time.utc(2000) # => Sat Jan 01 00:00:00 UTC 2000 # t.in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00 # t.in_time_zone('Hawaii') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 def in_time_zone(zone) - ActiveSupport::TimeWithZone.new(self, get_zone(zone)) + ActiveSupport::TimeWithZone.new(utc? ? self : getutc, get_zone(zone)) end # Returns the simultaneous time in Time.zone |