pythongoogle-apigoogle-calendar-apigoogle-api-clientgoogle-calendar-recurring-events

Google Calendar API Recurrent Event, EXDate not working


I want to create a recurrent event into Google Calendar with one day exclusive. I used Google Calendar APi explorer. Below is the Request Data

{
  "end": {
    "dateTime": "2020-02-24T19:00:00+05:00",
    "timeZone": "Asia/Karachi"
  },
  "start": {
    "dateTime": "2020-02-24T18:30:00+05:00",
    "timeZone": "Asia/Karachi"
  },
  "description": "PSL live Streaming  ..",
  "summary": "PSL live Streaming  ..",
  "location": "National Stadium Karachi",
  "recurrence": [
    "RRULE:FREQ=DAILY;UNTIL=20200229T185959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU",
    "EXDATE;VALUE=DATE:20200225"
  ],
  "reminders": {
    "useDefault": false,
    "overrides": [
      {
        "method": "email",
        "minutes": 15
      },
      {
        "method": "popup",
        "minutes": 15
      }
    ]
  }

I got response

{
 "kind": "calendar#event",
 "status": "confirmed",
 "summary": "PSL live Streaming  ..",
 "description": "PSL live Streaming  ..",
 "location": "National Stadium Karachi",
 "start": {
  "dateTime": "2020-02-24T18:30:00+05:00",
  "timeZone": "Asia/Karachi"
 },
 "end": {
  "dateTime": "2020-02-24T19:00:00+05:00",
  "timeZone": "Asia/Karachi"
 },
 "recurrence": [
  "EXDATE;VALUE=DATE:20200225",
  "RRULE:FREQ=DAILY;UNTIL=20200229T185959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU"
 ],
 "sequence": 0,
 "reminders": {
  "useDefault": false,
  "overrides": [
   {
    "method": "email",
    "minutes": 15
   },
   {
    "method": "popup",
    "minutes": 15
   }
  ]
 }
}

This event should not be created on 25th, but when i go to google calendar is see event is also created on 25h. enter image description here

Any hint, what's been wrong here?


Solution

  • You provided a dateTime in start and end, and a date in EXDATE.

    Since you provided a dateTime for start and end, you should also provide a dateTime in EXDATE, and the time part should match the one you provided in start. Otherwise, the API won't know what event to exclude.

    That is to say, the recurrence should be like this:

    "RRULE:FREQ=DAILY;UNTIL=20200229T185959Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU",
    "EXDATE;TZID=Asia/Karachi:20200225T183000"
    

    Reference: