Compare this date with another date.
other can also be a Numeric value, in which case it is interpreted as an Astronomical Julian Day Number.
Comparison is by Astronomical Julian Day Number, including fractional days. This means that both the time and the timezone offset are taken into account when comparing two DateTime instances. When comparing a DateTime instance with a Date instance, the time of the latter will be considered as falling on midnight UTC.
# File lib/date.rb, line 1370 def <=> (other) case other when Numeric; return @ajd <=> other when Date; return @ajd <=> other.ajd end nil end
can accept a Numeric object as other, the reverse is not true:
cannot accept a Date object as other.
So if you are sorting a list containing a mix of dates and numbers, you can get different results depending on the starting order!