= private = protected
between?(min, max)
Returns true if the current object’s time is within the specified min and max time.
# File activesupport/lib/active_support/time_with_zone.rb, line 229 def between?(min, max) utc.between?(min, max) end
You can check a date resides between two dates.
Date.today.between?(Date.yesterday, Date.tomorrow)
will return true
Date.yesterday.between?(Date.today, Date.tomorrow)
will return false
Have look how #between? handle adge case. It’s different from DateTime’s.
Date.yesterday.between?(Date.yesterday, Date.tomorrow) => true Date.tomorrow.between?(Date.yesterday, Date.tomorrow) => true