class Time
def compare_with_coercion(other)
Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
def compare_with_coercion(other) # we're avoiding Time#to_datetime cause it's expensive if other.is_a?(Time) compare_without_coercion(other.to_time) else to_datetime <=> other end end