I have an event with start_time
and end_time
and want to check if the event is \"in progress\". That would be to check if today\'s date is in the r
Because the date class includes the Comparable module, every date object has a between?
method.
require 'date'
today = Date.today
tomorrow = today + 1
one_month_later = today >> 1
tomorrow.between?(today, one_month_later) # => true
If they're timestamps:
def in_progress? (start_time..end_time).include?(Time.now) end