1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

This commit is contained in:
Jeremy Kemper 2009-08-22 15:53:19 -07:00
parent b58acea569
commit e93d0a50c0

View file

@ -172,7 +172,8 @@ class Time
# 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