-
Notifications
You must be signed in to change notification settings - Fork 295
Updating events
When updating or editing an event, there are usually a couple main use-cases: updating a single event, updating a single event in a recurring series of events, or updating all events in a series of recurring events.
Updating a single event is fairly straightforward. Simply supply the details argument with the event's id
as well as any other fields to be replaced.
RNCalendarEvents.saveEvent('Update: New Title', {
id: 'FE6B128F-C0D8-4FB8-8FC6-D1D6BA015CDE',
notes: 'The meeting location has changed',
location: 'San Franscisco, CA'
})
In this case, id
is the assigned identifier for the specific event and the title
, notes
, and location
fields will be updated for this event.
For updating recurring events, there are several options: update all events, update all future events from a specific date, or update a single event in the series.
This is by far the simplest. It follows the same pattern as the example above. Simply define the event's id
and fields. Done!
RNCalendarEvents.saveEvent('Update: New Title', {
id: 'FE6B128F-C0D8-4FB8-8FC6-D1D6BA015CDE',
notes: 'The meeting location has changed',
location: 'San Franscisco, CA'
})
Updating a single event requires a little more work. Similar to the example above, you must provide the event's id
as well as any fields that should be updated; and a third options parameter is also needed. This options parameter should define the event's start date on the exceptionDate
property. Its important that the exceptionDate
be the exact same date and time as the event to be updated, since this is how it finds the exact single instance in the recurring series.
RNCalendarEvents.saveEvent('Update: New Title', {
id: 'FE6B128F-C0D8-4FB8-8FC6-D1D6BA015CDE',
notes: 'The meeting location has changed',
location: 'San Franscisco, CA'
}, {
exceptionDate: '2016-08-19T19:26:00.000Z', // used to lookup event instance start date
futureEvents: false
})
This specific to iOS events. It allows for the ability to specify an event, updating it and all of its future recurring events.
RNCalendarEvents.saveEvent('Update: New Title', {
id: 'FE6B128F-C0D8-4FB8-8FC6-D1D6BA015CDE',
notes: 'The meeting location has changed',
location: 'San Franscisco, CA'
}, {
exceptionDate: '2016-08-19T19:26:00.000Z', // used to lookup event instance start date
futureEvents: true // update future events starting from the exception date
})