Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit a60779f

Browse files
committed
Ruby 1.9: fix Time#beginning_of_day inaccuracy due to subtracting a Float
1 parent 63f9426 commit a60779f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

activesupport/lib/active_support/core_ext/time/calculations.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ def next_week(day = :monday)
201201

202202
# Returns a new Time representing the start of the day (0:00)
203203
def beginning_of_day
204-
(self - self.seconds_since_midnight).change(:usec => 0)
204+
#(self - seconds_since_midnight).change(:usec => 0)
205+
change(:hour => 0, :min => 0, :sec => 0, :usec => 0)
205206
end
206207
alias :midnight :beginning_of_day
207208
alias :at_midnight :beginning_of_day

0 commit comments

Comments
 (0)