Calendar Component RRule

The rrule property on events can be an object or a correctly formatted string. Not all of the abilities of RRule are available when using the object such as EXDATE.

RRule object

If the rrule property is defined as an object the following options are available:

OptionDescription
freq(required) One of the following values: yearly, monthly, weekly, daily, hourly, minutely, secondly
dtstartThe recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, now will be used instead.
intervalThe interval between each freq iteration. For example, when using yearly, an interval of 2 means once every two years, but with hourly, it means once every two hours. The default interval is 1.
wkstThe week start day. Must be a string value like MO, TU, WE or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is MO.
countHow many occurrences will be generated.
untilThe recurrence end.
tzidIf given, this must be a string supported by Luxon, and the Luxon library must be provided.
bysetposIf given, it must be either an integer, or an array of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a monthly frequency, and a byweekday of (MO, TU, WE, TH, FR), will result in the last work day of every month.
bymonthIf given, it must be either an integer, or an array of integers, meaning the months to apply the recurrence to.
bymonthdayIf given, it must be either an integer, or an array of integers, meaning the month days to apply the recurrence to.
byyeardayIf given, it must be either an integer, or an array of integers, meaning the year days to apply the recurrence to.
byweeknoIf given, it must be either an integer, or an array of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year.
byweekdayIf given, it must be either an integer (0 == MO), an array of integers, one of the weekday values (MO, TU, etc), or an array of these constants. When given, these variables will define the weekdays where the recurrence will be applied.
byhourIf given, it must be either an integer, or an array of integers, meaning the hours to apply the recurrence to.
byminuteIf given, it must be either an integer, or an array of integers, meaning the minutes to apply the recurrence to.
bysecondIf given, it must be either an integer, or an array of integers, meaning the seconds to apply the recurrence to.
RRule String

A string in the format defined by RFC 5545.

When using the EXDATE property each date to be excluded must be provided as separate values separated by a \n

Some examples are provided below.

Example 1: Every week at 11am starting 8th March 2021 and ending 12th April 2021 – DTSTART:20210308T110000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220330T120000Z

Example 2: Every week at 12pm starting 8th March 2021 and ending 20th April 2021 except for 24th March 2021 – DTSTART:20210310T120000Z\nRRULE:FREQ=WEEKLY;UNTIL=20210420T120000Z\nEXDATE:20210324T120000Z

Example 3: Every day at 12am starting 19th March 2021 until 25th March 2021 except for 20th March 2021 and 23rd March 2021 – DTSTART:20210319T000000Z\nRRULE:FREQ=DAILY;UNTIL=20210325T000000Z;INTERVAL=1\nEXDATE:20210320T000000Z\nEXDATE:20210323T000000Z

Example 4: The first Monday and last Friday of every month for the year 2021 – DTSTART:20210101\nRRULE:UNTIL=20211231;FREQ=MONTHLY;INTERVAL=1;BYDAY=1MO,-1FR

Sidebar