Google Calendar API - Update recurring events after a date [duplicate] - google-calendar-api

This question already exists:
Update recurring event after a date
Closed 2 years ago.
I'm doing an integration with google calendar.
I need to update the information (without changing the date) of a recurring event from a date other than the first, and I need the changes to be applied in the following schedules.
Ex: Recurring scheduling 2020-07-20 through 2020-07-30
change the summary from the 23rd onwards
call PUT
https://www.googleapis.com/calendar/v3/calendars/{{id}}/events/{{event_id}}
{ "summary": "TESTE 123", "start": { "dateTime": "2020-07-23T19:00:00", "timeZone": "America/Sao_Paulo" }, "end": { "dateTime": "2020-07-23T20:00:00", "timeZone": "America/Sao_Paulo" }, "recurrence":[ "RRULE:FREQ=DAILY;UNTIL=20200730T235959Z;BYDAY=MO,TU,WE,TH,FR,SA"
The problem is that when doing it, the days 20, 21 and 22 are excluded,
When there is a change of dates I call the PUT and then the POST to create the other schedules, however, in this case there is no change of date and I cannot miss the recurrence.

The way i do it is the one suggested in API docs for google-calendar-api
First edit the original recurring event, limiting it to the date until which you want no
change. Do this by setting the UNTIL component of the RRULE to point before the start time of the first target instance
Then create a new recurring event with changed info.
You can get a better idea from this doc: Modify Recurring Event Partially

Related

how to show the dtstart and until using rrule plugin from daterange in fullcalendar 5

I am using fullcalendar 5 and when using eventClick i want to show the dtstart and until values from a recurrent event. I am using the rrule plugin.
When i click on asingle event, this gives me the data from start:
eventClick: function(info) {
alert(info.event.startStr); // something like 2021-05-04
but in case it is a recurrent event which has a date range from lets say 2021-05-01 till 2021-07-01
and the first occurrence appears on 2021-05-05, the alert show me this date (2021-05-05) and i want to show me the date of the start of the recurrence, so 2021-05-01. Really don't know how to get the startdate and enddate of the range from an recurrent event when i use the evenClick function in combination with rrule plugin...
Can someone help me with that?

Modify Google Calendar recurring Event using API

I am using Google Calendar API to create/modify recurring events
for e.g. - there is an event (Say ABC) having recurring events on Monday, Wednesday & Thursday till 31st January 2021 (say 30 occurrences). While creating this event, I calculated number of US holidays coming in this schedule (suppose 1) and increased the COUNT by that number (which will be now 31) and later delete those instances which were occurring those holidays (like 26th Nov, 27th Nov, 24th December etc). Everything works fine till here.
Now I've to add an attendee to this event which I'm able to do by sending a PATCH request (reference) with updated attendees list. This updates the attendees list but it undo's the instances that I deleted. I want recurring event to remain as it is.
TIA
After succesfully deleting the spare event instances, you should be able to add invitees to the non-deleted instance by specifying the recurringEventId as eventId
If for whatever reason this is not working as intended you can perform the following workaround:
Use the method Events: instances with the option showDeleted:false to retrieve the ids of all not deleted event recurrences
Use the method Events: patch in a loop specifying as eventId all single event ids retrieved in the step above
Mind:
While the recurringEventId should look something like qgthctibhb7755q02hnm3cdb3s, the id of each single instance should look something like qgthctibhb7755q02hnm3cdb3s_20201104 (the date is included in the id)

Getting google-calendar event id is of size more than 200 character for few events. which I need <200 char?

I have got calendar event for my accounts which contains unique ids for each event. For few events the id's are too large and my application needs id with size less than 200 character. But I am not sure why for few events the ids are too large? and not sure how to make it tiny without violating the uniqueness?
You can use UUID, which is a 128-bit almost random number ( I say almost because in practice the likelihood to repeat it, it's close enough to zero). Basically, all programming languages have their library that generates UUID and the result would be something like:
9d853330-21e1-415d-9237-9b80efb3b584
Then you would need to use the array method .split() or its equivalent depending in the language you're using to get an array like this one:
['9d853330', '21e1', '415d', '9237', '9b80efb3b584']
With that array, you could form a new string without the "-" due to it is not allowed as a valid id for your events as the docs say:
Opaque identifier of the event. When creating new single or recurring
events, you can specify their IDs. Provided IDs must follow these
rules: characters allowed in the ID are those used in base32hex
encoding, i.e. lowercase letters a-v and digits 0-9, see section 3.1.2
in RFC2938 the length of the ID must be between 5 and 1024 characters
the ID must be unique per calendar Due to the globally distributed
nature of the system, we cannot guarantee that ID collisions will be
detected at event creation time. To minimize the risk of collisions we
recommend using an established UUID algorithm such as one described in
RFC4122. If you do not specify an ID, it will be automatically
generated by the server. Note that the icalUID and the id are not
identical and only one of them should be supplied at event creation
time. One difference in their semantics is that in recurring events,
all occurrences of one event have different ids while they all share
the same icalUIDs.
An example request body specifying the generated id would look like this:
{
"end": {
"dateTime": "2019-12-20T17:00:00-07:00",
"timeZone": "America/Los_Angeles"
},
"start": {
"timeZone": "America/Los_Angeles",
"dateTime": "2019-12-19T09:00:00-07:00"
},
"id": "9d85333021e1415d92379b80efb3b584",
"summary": "Id test"
}

Google calendar PHP API time issue

I was playing with Google calendar's API explorer and managed to get the events list from my calendar. And i managed to insert some events into the calendar from API explorer. But im confused with the time property.
When i inserted an event from explorer, i wanted event time to be from 10:00 to 10:30. So i put as following:
{
"end": {
"dateTime": "2018-07-12T10:30:00.0z"
},
"start": {
"dateTime": "2018-07-12T10:00:00.0z"
}
}
Insertion was successful. But when i checked the calendar, its showing that event's time as 03:00-03:30. Date is correct. What I want is, if I insert 10:00 as start time it should be inserted as 10:00 irrespective of time zones and if I insert 10:30 as end time it should show 10:30.
How can I do that?

Show only Months with Events In them?

Would there be a way to limit the next/prev buttons to only show months with events registered in them? We have courses that fill up and I don't want users to have to fast forward through blank months where there is no availability of events. I'm also including holiday events from the basic google public holidays calendar and don't want to include those events.
As long as I know, this option does not exist in FullCalendar yet.
If you are retrieving events month by month:
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get the events and if there is no events, your function must call Next or Previous again.
If you are retrieving all events at once
You can bind fullcalendar's Next and Previous events to a new function. Inside this function, get all the events and look for the first date out of the current month. Set fullcalendar's current date for that month and refresh it.

Resources