aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-06-03 20:08:56 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-06-03 20:09:21 +0200
commitf9c2f76bea41c4a7ad1419844c6102211787c458 (patch)
treeebc0bddb5a8d16b0803d0cd776ec8f211a0b985d /activesupport/lib
parenta6fe33d8a3c09f3a70ee2a79f96ed5b2c9580d4f (diff)
downloadrails-f9c2f76bea41c4a7ad1419844c6102211787c458.tar.gz
rails-f9c2f76bea41c4a7ad1419844c6102211787c458.tar.bz2
rails-f9c2f76bea41c4a7ad1419844c6102211787c458.zip
The behavior we had in place in rc1 was actually to convert to DateTime and use <=> from there. Restore that.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index c7e8b6ae25..06e4847e82 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -120,10 +120,10 @@ class Date
)
end
- # Allow Dates to be compared with times. The Date will have its time set to 00:00:00 for the comparison.
+ # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
def compare_with_coercion(other)
if other.is_a?(Time)
- self.to_time <=> other
+ self.to_datetime <=> other
else
compare_without_coercion(other)
end