[Seaside] [ANN] ICal ocurrences

Jason Johnson jbjohns at libsource.com
Wed Nov 1 17:15:49 UTC 2006

Hello all,

I just published a new version of ICal (well a couple, ignore the first 
jbjohns) that now supports querying what occurences of an event are 
described by a recurrence rule.  The public API consists of the 
following 6 methods.

ICEvent>>occurrencesAfter: aTimeSpan
ICEvent>>occurrencesBetween: aStartTimeSpan and: anEndTimeSpan
ICEvent>>occurrences: aNumber
ICEvent>>occurrences: aNumber after: aTimeSpan
ICEvent>>occurrences: aNumber between: aStartTimeSpan and: anEndTimeSpan

The first two require the rule to have a count or until directive, since 
otherwise the set would be infinite (I will consider infinite sets later 
:) ).  All methods are constrained by the rule (i.e. if the rule has a 
count directive of 4 then occurrences: 6 will still return only 4).  The 
ICEvent>>isValidForDate: method was also changed, so that it checks if 
the given date is in the set.

Things to be aware of:
Right now the API only works for monthly recurrence rules, but I plan to 
put in more soon (I will be focusing on Weekly and above).  The rest 
will spit out some "does not understand" messages for the occurrence 
methods, but otherwise, everything works as before.
Right now the occurrence methods just return an ordered list of dates.  
I haven't decided yet what should be returned (just a DateAndTime, or 
maybe a complete event representing that day?) so I have just deferred 
for now.  Let me know what would be the most useful to you.
The classes wont change and the API listed above wont change, but the 
methods in the ICFrequency classes will be moved around some.
BUG: If your ICEvent uses multiple rules and they have common dates 
between them, they will all be in the returned set (i.e. there can be 
multiples of the same date).  I am thinking of using some other data 
structure then OrderedCollection to fix this problem, and remove the 
need for sorting to happen in various spots throughout.
ExclusionRules are not handled at the moment.
The methods are designed for TimeSpan resolution, but right now some of 
the lower level methods work on Date's.  This should mostly be 
transparent, except that the set returned are Date's, instead of 
DateAndTime's like they should be. :)

Thanks.  Hope this is useful to someone. :)

More information about the Seaside mailing list