<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Tomas,<div><br><div><blockquote type="cite"><div>I understand how to get the non-recurring-events and their start and end<br>datetime, after I got them all it's no biggie to sort them. The problem<br>is finding out a way to extract rr-events into a timespan.<br><br>I know I've seen code for that a while back but searching for it now I<br>can't find it. Help?<br></div></blockquote></div><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><br></div><div>See this post for an introduction: <a href="http://markmail.org/message/ggv345g5ulkli5xl">http://markmail.org/message/ggv345g5ulkli5xl</a></div><div><br></div><div>Once you've got an rruleset (which is a dateutil.rruleset object), you can use rruleset's between method.</div><div><br></div><div>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.</div><div><br></div><div>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!</div><div><br></div><div>- Jeffrey</div><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a><a href="http://markmail.org/message/ggv345g5ulkli5xl"></a></body></html>