aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorJarkko Laine <jarkko@jlaine.net>2012-03-23 11:10:14 +0200
committerJarkko Laine <jarkko@jlaine.net>2012-03-24 20:15:00 +0200
commit03becb13099c439f6aea5058546bc8b0b19b8db8 (patch)
treee73a162c31c4c2fefbcafe543dd6e0d31757998d /activesupport/lib/active_support/values
parent014498e1d74decd57d44d45c187fa4f4b968b811 (diff)
downloadrails-03becb13099c439f6aea5058546bc8b0b19b8db8.tar.gz
rails-03becb13099c439f6aea5058546bc8b0b19b8db8.tar.bz2
rails-03becb13099c439f6aea5058546bc8b0b19b8db8.zip
[#5559] Do not black out the system timezone DST jump hour if Time.zone differs from that.
The system timezone DST jump hour should not be blacked out by Time.zone.parse if current Time.zone does not do the jump at that time. Fixes #5559.
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index ce46c46092..18d6d9fc6f 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -268,7 +268,12 @@ module ActiveSupport
date_parts = Date._parse(str)
return if date_parts.empty?
time = Time.parse(str, now) rescue DateTime.parse(str)
+
if date_parts[:offset].nil?
+ if date_parts[:hour] && time.hour != date_parts[:hour]
+ time = DateTime.parse(str)
+ end
+
ActiveSupport::TimeWithZone.new(nil, self, time)
else
time.in_time_zone(self)