[Vobject] Getting a list of events (including rr:s) by datetime
Jeffrey Harris
jeffrey at skyhouseconsulting.com
Fri Apr 23 13:24:59 CDT 2010
Hi Tomas,
> I understand how to get the non-recurring-events and their start and end
> datetime, after I got them all it's no biggie to sort them. The problem
> is finding out a way to extract rr-events into a timespan.
>
> I know I've seen code for that a while back but searching for it now I
> can't find it. Help?
See this post for an introduction: http://markmail.org/message/ggv345g5ulkli5xl
Once you've got an rruleset (which is a dateutil.rruleset object), you can use rruleset's between method.
Note that the between method knows nothing about the duration of your event. So if you have a three day event recurring monthly, using between may miss an occurrence that begins before your interval but ends after the interval begins (if it was a Friday-Sunday event, and the beginning of the month you're looking at is on that Saturday, for instance). A perfect implementation of this would look at start/end, move start backwards by the duration of the event, then filter out false positives that created.
I have pondered writing a helper method to do this work for you, but I haven't gotten around to it. I'm sure it would help lots of folks, though, if anyone else wants to send me a patch!
- Jeffrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.skyhouseconsulting.com/pipermail/vobject/attachments/20100423/2c19fcb0/attachment.htm
More information about the VObject
mailing list