views:

132

answers:

0

I am developing a Google like calendar on Rails and am using Runt to define the recurrence patterns for creating events. However, the restriction with the calendar is that there cannot be two events for same time slot. So, if i have an event created with

event = REDay.new(13,00,15,00)  # daily between 1PM to 3 PM

Then the application should not allow to create another event that overlaps this one.

Is there some way of finding whether a Runt expression overlaps with another expression?

I came across similar question at http://stackoverflow.com/questions/831864/finding-schedule-overlaps-with-ruby-runt and the solution says that "create a DateRange object from your expr and then run overlap", but i am not sure how to do this. Also, what would happen where there is no date range e.g. in the example given above there is no start and end date.