Skip to content
Browse files

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

…loat
  • Loading branch information...
1 parent b58acea commit e93d0a50c0e8cdc2507a7a211fc96404ad738152 @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
@@ -172,7 +172,8 @@ def next_week(day = :monday)
# Returns a new Time representing the start of the day (0:00)
def beginning_of_day
- (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

1 comment on commit e93d0a5

@ujihisa

cool

Please sign in to comment.
Something went wrong with that request. Please try again.