From eb5b93be74ed3eca925c1ab9bd4739919ae39a41 Mon Sep 17 00:00:00 2001 From: Scott Fleckenstein Date: Wed, 7 May 2008 06:54:07 -0700 Subject: Fix Time.zone.parse from stripping time zone information and make Time aware attribute methods use Time.zone.parse instead of to_time --- activesupport/lib/active_support/values/time_zone.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activesupport/lib/active_support/values') diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 9cdc2a74ed..2342cd182c 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -214,6 +214,9 @@ class TimeZone # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 def parse(str, now=now) time = Time.parse(str, now) rescue DateTime.parse(str) + unless time.is_a?(DateTime) || Date._parse(str)[:offset].nil? + time += time.in_time_zone(self).utc_offset - time.utc_offset + end ActiveSupport::TimeWithZone.new(nil, self, time) end -- cgit v1.2.3