aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-06-12 10:56:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-06-12 10:56:18 -0700
commit04e727dac46a0cfbd0e5eeb419efafad39ca9f57 (patch)
tree82014a130e545fcdf9001c6e37079b9418f1279a /activesupport/lib/active_support
parent07b4078eb664dd45b1526a85358574ea8e669ce3 (diff)
parent0599bfa2bc49c885fd4ec3ab7ecce37dc5c03ce5 (diff)
downloadrails-04e727dac46a0cfbd0e5eeb419efafad39ca9f57.tar.gz
rails-04e727dac46a0cfbd0e5eeb419efafad39ca9f57.tar.bz2
rails-04e727dac46a0cfbd0e5eeb419efafad39ca9f57.zip
Merge pull request #18365 from pocke/fix_datatime_compare
DateTime#<=> return nil when compare to the invalid String as Time.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/calculations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
index 55ad384f4f..95617fb8c2 100644
--- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
@@ -168,7 +168,7 @@ class DateTime
if other.kind_of?(Infinity)
super
elsif other.respond_to? :to_datetime
- super other.to_datetime
+ super other.to_datetime rescue nil
else
nil
end