Permalink
Browse files

Ruby 1.9: fix Time#beginning_of_day inaccuracy due to subtracting a F…

…loat
  • Loading branch information...
1 parent 63f9426 commit a60779f7e69a7045a308844e9464d7d6b9cac94d @jeremy jeremy committed Aug 22, 2009
Showing with 2 additions and 1 deletion.
  1. +2 −1 activesupport/lib/active_support/core_ext/time/calculations.rb
View
3 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

0 comments on commit a60779f

Please sign in to comment.