-
Notifications
You must be signed in to change notification settings - Fork 84
Home
Rémi Lanvin edited this page Jun 30, 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 ifCOUNT
orBYSETPOS
are used. - The current algorithm to compute occurrences is faster at lower frequencies and slower at higher the frequencies. So
YEARLY
is faster thatMONTHLY
which is faster thanWEEKLY
and 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 (
MINUTELY
orSECONDELY
) 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 before eventually returning an empty set.