Recurring events

Learn how to deal with recurring events using Unipile API.

Some events occur multiple times on a regular schedule, such as weekly meetings, birthdays, and holidays. Other than having different start and end times, these repeated events are often identical.

Events are called recurring if they repeat according to a defined schedule. Single events are non-recurring and happen only once.


Recurrence rule

The schedule for a recurring event is defined in two parts:

  • Its start and end fields (which define the first occurrence, as if this were just a stand-alone single event), and
  • Its recurrence field (which defines how the event should be repeated over time).
    The recurrence field contains an array of strings representing one or several RRULE, RDATE or EXDATE properties as defined in RFC 5545.

The RRULE property is the most important as it defines a regular rule for repeating the event. It is composed of several components. Some of them are:

  • FREQ — The frequency with which the event should be repeated (such as DAILY or WEEKLY). Required.
  • INTERVAL — Works together with FREQ to specify how often the event should be repeated. For example, FREQ=DAILY;INTERVAL=2 means once every two days.
  • COUNT — Number of times this event should be repeated. You can use either COUNT or UNTIL to specify the end of the event recurrence. Don't use both in the same rule.
  • UNTIL — The date or date-time until which the event should be repeated (inclusive).
  • BYDAY — Days of the week on which the event should be repeated (SU, MO, TU, etc.). Other similar components include BYMONTH, BYYEARDAY, and BYHOUR.

The RDATE property specifies additional dates or date-times when the event occurrences should happen. For example, RDATE;VALUE=DATE:19970101,19970120. Use this to add extra occurrences not covered by the RRULE.

The EXDATE property is similar to RDATE, but specifies dates or date-times when the event should not happen. That is, those occurrences should be excluded. This must point to a valid instance generated by the recurrence rule.

EXDATE and RDATE can have a time zone, and must be dates (not date-times) for all-day events.

Each of the properties may occur within the recurrence field multiple times. The recurrence is defined as the union of all RRULE and RDATE rules, minus the ones excluded by all EXDATE rules.


Here are some examples of recurrent events:

An event that happens from 6am until 7am every Tuesday and Friday starting from September 15th, 2015 and stopping after the fifth occurrence on September 29th:

"start": {  
	"date_time": "2015-09-15T06:00:00",  
  "timeZone": "Europe/Zurich"  
},  
"end": {  
  "dateTime": "2015-09-15T07:00:00",  
  "timeZone": "Europe/Zurich"  
},  
"recurrence": [  
  "RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=TU,FR"  
],

An all-day event starting on June 1st, 2015 and repeating every 3 days throughout the month, excluding June 10th but including June 9th and 11th:

"start": {  
  "date": "2015-06-01"  
},  
"end": {  
  "date": "2015-06-02"  
},  
"recurrence": [  
  "EXDATE;VALUE=DATE:20150610",  
  "RDATE;VALUE=DATE:20150609,20150611",  
  "RRULE:FREQ=DAILY;UNTIL=20150628;INTERVAL=3"  
],

Instances & exceptions

A recurring event consists of several instances: its particular occurrences at different times. These instances act as events themselves.

Recurring event modifications can either affect the whole recurring event (and all of its instances), or only individual instances. Instances that differ from their parent recurring event are called exceptions.

For example, an exception may have a different summary, a different start time, or additional attendees invited only to that instance. You can also cancel an instance altogether without removing the recurring event (instance cancellations are reflected in the event status).