From 5ae7a9d31d6222b265013ab450f9d30b88113e69 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 17 Jun 2010 14:10:51 -0700 Subject: when the timezone is nil, a TimeWithZone object should not be constructed. [#4881 state:resolved] Signed-off-by: Jeremy Kemper --- activesupport/lib/active_support/core_ext/date_time/zones.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/lib/active_support/core_ext/date_time/zones.rb') diff --git a/activesupport/lib/active_support/core_ext/date_time/zones.rb b/activesupport/lib/active_support/core_ext/date_time/zones.rb index 98565e6750..6002d4ad2a 100644 --- a/activesupport/lib/active_support/core_ext/date_time/zones.rb +++ b/activesupport/lib/active_support/core_ext/date_time/zones.rb @@ -12,6 +12,8 @@ class DateTime # # DateTime.new(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00 def in_time_zone(zone = ::Time.zone) + return self unless zone + ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.__send__(:get_zone, zone)) end end -- cgit v1.2.3