diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-22 15:53:19 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-22 15:53:19 -0700 |
commit | e93d0a50c0e8cdc2507a7a211fc96404ad738152 (patch) | |
tree | 98d779389cba654d64dd6ad4728ac6c5b6c16752 /activesupport/lib/active_support/core_ext/time/calculations.rb | |
parent | b58acea5696c777ae828d7866fcff334d493b4d3 (diff) | |
download | rails-e93d0a50c0e8cdc2507a7a211fc96404ad738152.tar.gz rails-e93d0a50c0e8cdc2507a7a211fc96404ad738152.tar.bz2 rails-e93d0a50c0e8cdc2507a7a211fc96404ad738152.zip |
Ruby 1.9: fix Time#beginning_of_day inaccuracy due to subtracting a Float
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/calculations.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 4f3b869f50..4f4492f0fd 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -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 |