From f449da53ac69495e736c7f1ce0f1bc6ebe356081 Mon Sep 17 00:00:00 2001 From: Nate Mueller Date: Thu, 2 Jun 2011 20:43:23 -0700 Subject: Make String.to_time respect timezones --- activesupport/lib/active_support/core_ext/string/conversions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/string') diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index 5b2cb6e331..664537eea4 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -34,9 +34,9 @@ class String # Form can be either :utc (default) or :local. def to_time(form = :utc) return nil if self.blank? - d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction).map { |arg| arg || 0 } + d = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction, :offset).map { |arg| arg || 0 } d[6] *= 1000000 - ::Time.send("#{form}_time", *d) + ::Time.send("#{form}_time", *d[0..6]) - d[7] end def to_date -- cgit v1.2.3