When I wrote a calendar application for myself, many years ago, I simply stole the scheduling engine from cron and used it for recurring events. for example, something that happens on the second Saturday of every month, except January, will include the instruction "repeat = * 2-12 8-14 6" (every year, months 2-12, the second week runs from 8th to 14th and 6 on Saturday because I used 0-based numbering for the days of the week).
Although it is fairly easy to determine if an event occurs on any given date, it is not able to handle the repetition of "every N days," and is also less intuitive for users who are not compatible with Linux.
To deal with unique data for individual instances of events and delete / reschedule, I simply tracked how events outside events were calculated and the resulting events are stored in a database, where they can then be changed, moved or deleted without affecting the original current information about events. When a new recurring event was added, all instances were immediately calculated before the current “last settlement” date.
I am not saying that this is the best way to do this, but it is a way, and one that works well within the limitations that I mentioned earlier.
Dave Sherohman Sep 24 '08 at 6:46 2008-09-24 06:46
source share