10931 Posts in 2614 Topics by 1810 members
|Go to End|
23 May 2013 at 7:27am Last edited: 23 May 2013 7:28am
I've been working with the Event Calendar module as a means to enumerate my library's locations' open hours, and have had some difficulties with recurrence.
The data model is thus:
CalendarDateTime has a start date, end date, start time and end time (as well as they "all day" marker).
CalendarEvent has multiple CalendarDateTimes, which can be used to enumerate specific instances of this event occurring without a predictable pattern. Each one you specify will show up in the appropriate calendar view so long as you don't turn on Recurrence. Each entry will have the following details:
* Starts on: CalendarDateTime->start_date + CalendarDateTime->start_time
* Ends on: CalendarDateTime->end_date + CalendarDateTime->end_time
CalendarEvent also has Recurrence, which can be toggled on, then set to daily, weekly or monthly, with some interval between. When Recurrence is set, only the first CalendarDateTime is consulted, and the recurrence continues until the day before that CalendarDateTime->end_date. So the entries look like this:
* Starts on: CalendarDateTime->start_date +CalendarDateTime->start_time
* Ends on: CalendarDateTime->start_date + CalendarDateTime->end_time
Notice the differences: without recurrence, we can have event entries that span multiple days, while with recurrence, single-day events are created between the two dates specified in the first CalendarDateTime. This different usage of fields depending on whether recurrence is enabled or not seems potentially problematic.
I think there are two possible solutions to this confusion:
1. Attach Recurrence to the CalendarDateTime, not the CalendarEvent. This would allow for a whole new level of grouping recurring events: if you had weekly recurring events Sunday - Saturday, you could define all 7 days worth of recurrences on one event. You could also mix in non-recurring instances of the CalendarEvent if needed.
2. Keep Recurrence attached to CalendarEvent, but apply the pattern to all the CalendarDateTimes. This would be simpler as the data model would need to change less, but there would be overall flexibility in terms of pattern.
In either case, I think we need to either use include a RecurUntilDate and/or RecurXTimes that's separate from the end_date, so that multiple day events can recur. I think it may also be clearer to include that date in the recurrence, instead of stopping the day before (simple matter of changing "<=" to "<").
I'd very much like to hear others' opinions on the matter. What would work best for your use cases?
|Go to Top|