Repository navigation
Home
Rémi Lanvin edited this page Jul 1, 2015
·
18 revisions
This library offers a small, complete, and very fast, implementation of the recurrence rules documented in the iCalendar RFC. It is heavily based on python-dateutil.
- Unlike documented in the RFC, and like in the Python version, the starting datetime (
DTSTART) is not the first recurrence instance, unless it does fit in the specified rules. This behavior makes more sense than otherwise and is easier to work with. This will only change the results ifCOUNTorBYSETPOSare used. - The current algorithm to compute occurrences is faster at lower frequencies and slower at higher the frequencies. So
YEARLYis faster thatMONTHLYwhich is faster thanWEEKLYand so on. So if you want to achieve the fastest calculation time, whenever possible, try to use the lowest possible frequency. For example, to get "every day in january" it is slightly faster to write['freq' => 'yearly','bymonth' => 1,'bymonthday' => range(1,31)]rather than['freq' => 'daily','bymonth' => 1]. - Computing all occurrences of rule might get noticeably slow with very high frequencies (
MINUTELYorSECONDELY) if the rule last a long period of time (such as many years). - Some perfectly RFC-compliant rules are actually impossible and will produce no result. For example "every year, on week 40, in February" (week 40 will never occur in February). In a cases like that, the library will still try to find occurrences, because the rule is technically valid, before returning an empty set once all the possibilities have been exhausted.