From a60779f7e69a7045a308844e9464d7d6b9cac94d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 22 Aug 2009 15:53:19 -0700 Subject: [PATCH] Ruby 1.9: fix Time#beginning_of_day inaccuracy due to subtracting a Float --- activesupport/lib/active_support/core_ext/time/calculations.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 5ed750afcc668..17dfc3129907d 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -201,7 +201,8 @@ def next_week(day = :monday) # Returns a new Time representing the start of the day (0:00) def beginning_of_day - (self - self.seconds_since_midnight).change(:usec => 0) + #(self - seconds_since_midnight).change(:usec => 0) + change(:hour => 0, :min => 0, :sec => 0, :usec => 0) end alias :midnight :beginning_of_day alias :at_midnight :beginning_of_day