Search code examples
google-calendar-apirrule

Google Calendar API, RRULE and EXDATE


I'm trying to export some events to Google Calendar with the API, specifically the python library that wraps it. These events have recurrence, which is defined to Google Calendar with an RRULE string, and I'm trying to exclude certain dates with EXDATE strings.

Here's what I'm sending:

{
    "summary": "Test Event", 
    "description": "Event", 
    "location": "Home", 
    "start": {
        "timeZone": "America/New_York", 
        "dateTime": "2014-09-05T10:30:00"
    }, 
    "end": {
        "timeZone": "America/New_York", 
        "dateTime": "2014-09-05T11:35:00"
    }, 
    "recurrence": [
        "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=FR;UNTIL=20141203T173500Z", 
        "EXDATE:20141002"
    ], 
}

It exports all correctly, except the EXDATE isn't respected. Well, it's sort of respected. In the calendar, the event still exists, however it describes the repetition as "Weekly at 10:30am on Monday, Wednesday, Thursday from Wed Sep 3 to Wed Dec 3 except Thu Oct 2".

The "except Thu Oct 2" part implies it is parsing the EXDATE correctly (and if I send garbage in the EXDATE, it won't run, so it is parsing it), but the event still occurs.


Solution

  • EXDATE must be in the same format as the start and end. That means if the start is an event with time, the EXDATE must also have the time specified. I recommend reading on this in the rfc 5545 (https://www.rfc-editor.org/rfc/rfc5545).