summaryrefslogtreecommitdiff
path: root/lib/date.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/date.rb')
-rw-r--r--lib/date.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/date.rb b/lib/date.rb
index a400c2afdc..3bb0875023 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1371,6 +1371,12 @@ class Date
case other
when Numeric; return @ajd <=> other
when Date; return @ajd <=> other.ajd
+ else
+ begin
+ l, r = other.coerce(self)
+ return l <=> r
+ rescue NoMethodError
+ end
end
nil
end
@@ -1385,6 +1391,9 @@ class Date
case other
when Numeric; return jd == other
when Date; return jd == other.jd
+ else
+ l, r = other.coerce(self)
+ return l === r
end
false
end