views:

153

answers:

3

I am having to build a web app that has an event calendar section. Like in Outlook, the requirement is that users can set up recurrent events, and can move individual events around within a series of events.

  1. What methods could one use to store (in a database) the various ways you can describe the recurrence pattern of a series?
  2. How would one record the exceptions?
  3. What strategies do you use to manage redefining the series and its effects on the exceptions?

I've done this a couple of times, differently, but I'd like to see how others have tackled this issue.

+3  A: 

Have a look at how the iCal format deals with recurrence patterns and recurrence exceptions. If you want to publish the events at some point, you will have a hard time avoiding iCal anyway, so you could just as well do it in a compatible way from the start.

Tomalak
+1 since I was clearly thinking the same thing ;-)
David Zaslavsky
Good point. The last two times I've had to do this, common protocol support wasn't as important. I can see it will be this time. Thanks for the "mental prod" to go look down this avenue.
alphadogg
+2  A: 

For one thing: if you're not already familiar with it, take a look at RFC 2445 which defines the iCalendar specification for exactly this kind of pattern.

David Zaslavsky
+1 for the RFC link. ;-) Though the RFC is a PITA to read.
Tomalak
Yeah... I usually consider them a reference-of-last-resort.
David Zaslavsky
A: 

I've typically provided front-end logic that allows a user to specify a recurring event, but then actually used individual database entries to record the events as seperate records in SQL server.

In other words, they can specify a meeting every Monday night at 7PM, but I record 52 records for the year so that individual meetings can be changed, deleted or additional information added to those events.

I provide methods to allow the user to cancel all future events, and then re-enter a new recurring series if they need to.

I've not come up with a perfect way to handle this, so I'll will monitor this thread to see if any great suggestions come up.

EJB