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 range between the two dates.
How would you do this in a function?
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 range between the two dates.
How would you do this in a function?
If you are using Rails, you could try this:
Note: I just used
beginning_of_day
andend_of_day
to provide an easy range. The important part is theinclude_with_range?
method on a Range.If they're timestamps: