pythoncalendargoogle-calendar-apirfc5545google-calendar-recurring-events

rfc 5545 recurrance start date issue


I have been trying to automate some event creations at the facility I work in. With Google Calendar API I am creating events and adding attendees.

  event = {
            'summary': 'testing the calendar api',
            'start': {'dateTime': '2020-06-04T23:00:00', 'timeZone': 'x/y'},
            'end': {'dateTime': '2020-06-04T23:30:00', 'timeZone': 'x/y'},
            'attendees': [{
                'email': 'x@y'
            }],
            'recurrence': ['RRULE:FREQ=WEEKLY;BYDAY=FR,SA;UNTIL=20200615']
        }

Here despite me specifying which dates the event occurs, I still get one event on the start date. I want to prevent creating the event on the start date unless it falls into the BYDAY params. I tried looking for it on here but couldn't figure it out. Any suggestions?


Solution

  • In the Event resource it is announced that "for a recurring event, (the start property) is the start time of the first instance". In your case, the recurrence property determinates to only celebrate the event on fridays and saturdays. Also, the start property of your request falls on a thursday. All this means that the event will be created on fridays, saturday and that initial thursday. If you don't want to create an event on that thurdsday, you can do it just by changing the start/end dates with something similar to this:

    {
      "summary": "testing the calendar api",
      "start": {
        "dateTime": "2020-06-05T23:00:00",
        "timeZone": "x/y"
      },
      "end": {
        "dateTime": "2020-06-05T23:30:00",
        "timeZone": "x/y"
      },
      "attendees": [
        {
          "email": "x@y"
        }
      ],
      "recurrence": [
        "RRULE:FREQ=WEEKLY;BYDAY=FR,SA;UNTIL=20200615"
      ]
    }
    

    Please, ask me any question if you still have doubts.