From 1e48173e6ae72d326625ea98f220e1654261c756 Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Thu, 14 Oct 2010 07:40:30 +1100 Subject: [PATCH] don't call to_time on Time object. Fixes Ruby 1.9 bug which changes the zone to local when calling to_time on a Time object! Lame! I mean seriously, Rails created the method and then Ruby copies it into core and changes the behaviour. Why? --- lib/validates_timeliness/conversion.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validates_timeliness/conversion.rb b/lib/validates_timeliness/conversion.rb index 5d107a5..212e068 100644 --- a/lib/validates_timeliness/conversion.rb +++ b/lib/validates_timeliness/conversion.rb @@ -11,7 +11,7 @@ module ValidatesTimeliness when :date value.to_date when :datetime - value.to_time + value.is_a?(Time) ? value : value.to_time end if options[:ignore_usec] && value.is_a?(Time) ValidatesTimeliness::Parser.make_time(Array(value).reverse[4..9], @timezone_aware)