Skip to main content
Version: v8

@capacitor/calendar

Create, find, modify and remove events in the device calendar.

Installโ€‹

To use npm

npm install @capacitor/calendar

To use yarn

yarn add @capacitor/calendar

Sync native files

npx cap sync

iOSโ€‹

Add the calendar usage-description keys to your app's Info.plist; iOS crashes on first calendar access without them. iOS 17 split calendar access into two levels with their own keys; keep the pre-17 key for older devices:

<key>NSCalendarsFullAccessUsageDescription</key>
<string>We need access to your calendar to search, create and remove events.</string>
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
<string>We need access to your calendar to create events.</string>
<key>NSCalendarsUsageDescription</key>
<string>We need access to your calendar to search, create and remove events.</string>

Notes:

  • The plugin uses the current EventKit access APIs (requestFullAccessToEvents / requestWriteOnlyAccessToEvents on iOS 17+), never the deprecated requestAccess(to:). writeCalendar is satisfied by write-only access ("Add Events Only"); readCalendar requires full access.
  • createEventInteractively presents the system event editor, which on iOS 17+ needs no calendar permission at all.
  • EventKit stores dates at second granularity, so startDate/endDate read back with milliseconds truncated. Android keeps exact milliseconds.

Androidโ€‹

The plugin declares READ_CALENDAR and WRITE_CALENDAR in its own manifest; Gradle manifest merging adds them to your app automatically. Methods also request the runtime permission they need when it has not been granted yet: read for findEvents/listCalendars, write for createEvent/createCalendar, both for modifyEvent/deleteEvent/ deleteCalendar.

Platform notes:

  • createEventInteractively opens the system calendar editor, which reports neither the saved event's id nor a cancel, so the call resolves with an empty result when the editor closes.
  • CreateEventOptions.url is ignored: the platform's event model has no URL field.

Errorsโ€‹

Every rejection carries a structured code + message:

CodeMeaning
OS-PLUG-CLDR-0000Unknown error
OS-PLUG-CLDR-0001Invalid argument (e.g. no matching event)
OS-PLUG-CLDR-0003Pending operation (e.g. editor already open)
OS-PLUG-CLDR-0004I/O error
OS-PLUG-CLDR-0005Not supported
OS-PLUG-CLDR-0006Operation cancelled (editor closed)
OS-PLUG-CLDR-0020Permission denied

APIโ€‹

checkPermissions()โ€‹

checkPermissions() => Promise<CalendarPermissionStatus>

Returns the current calendar permission state without prompting.

On iOS 17+, readCalendar reflects full access; writeCalendar is also granted by write-only access ("Add Events Only").

Returns:

Promise<CalendarPermissionStatus>

Since: 1.0.0


requestPermissions(...)โ€‹

requestPermissions(options?: RequestPermissionsOptions | undefined) => Promise<CalendarPermissionStatus>

Prompts for the given calendar permissions (both when omitted).

On iOS, requesting readCalendar prompts for full access; requesting only writeCalendar prompts for write-only access on iOS 17+.

ParamType
options
RequestPermissionsOptions

Returns:

Promise<CalendarPermissionStatus>

Since: 1.0.0


createEvent(...)โ€‹

createEvent(options: CreateEventOptions) => Promise<CreateEventResult>

Creates a calendar event silently and resolves with its id.

Requires write permission; requests it when not yet determined.

ParamType
options
CreateEventOptions

Returns:

Promise<CreateEventResult>

Since: 1.0.0


createEventInteractively(...)โ€‹

createEventInteractively(options: CreateEventOptions) => Promise<CreateEventResult>

Opens the system event-editing UI prefilled with the given values. Resolves when the user saves (with the new event's id where the platform provides one; Android does not) and fails with OS-PLUG-CLDR-0006 when the user cancels.

On iOS 17+ the editor needs no calendar permission. On Android and older iOS versions, write permission is requested first.

ParamType
options
CreateEventOptions

Returns:

Promise<CreateEventResult>

Since: 1.0.0


modifyEvent(...)โ€‹

modifyEvent(options: ModifyEventOptions) => Promise<void>

Updates the first event matching filter with the values in newEvent. Only the fields present in newEvent are changed. Fails with OS-PLUG-CLDR-0001 when no event matches.

Requires read and write permission.

ParamType
options
ModifyEventOptions

Since: 1.0.0


findEvents(...)โ€‹

findEvents(options: FindEventsOptions) => Promise<FindEventsResult>

Returns events matching the filter fields within the date range. title, location and notes match case-insensitive substrings; calendarName restricts the search to that calendar. A recurring event is returned once per occurrence in the range, each with its own dates.

Requires read permission.

ParamType
options
FindEventsOptions

Returns:

Promise<FindEventsResult>

Since: 1.0.0


deleteEvent(...)โ€‹

deleteEvent(options: DeleteEventOptions) => Promise<void>

Deletes events: by id when given, otherwise every event matching the filter fields. Fails with OS-PLUG-CLDR-0001 when nothing matches. Deleting a recurring event removes the entire series.

Requires read and write permission.

ParamType
options
DeleteEventOptions

Since: 1.0.0


listCalendars()โ€‹

listCalendars() => Promise<ListCalendarsResult>

Returns the calendars available on the device.

Requires read permission.

Returns:

Promise<ListCalendarsResult>

Since: 1.0.0


createCalendar(...)โ€‹

createCalendar(options: CreateCalendarOptions) => Promise<CreateCalendarResult>

Creates a calendar and resolves with its id.

Requires write permission.

ParamType
options
CreateCalendarOptions

Returns:

Promise<CreateCalendarResult>

Since: 1.0.0


deleteCalendar(...)โ€‹

deleteCalendar(options: DeleteCalendarOptions) => Promise<void>

Deletes the calendar with the given name. Fails with OS-PLUG-CLDR-0001 when no calendar has that name.

Requires read and write permission.

ParamType
options
DeleteCalendarOptions

Since: 1.0.0


openCalendar(...)โ€‹

openCalendar(options?: OpenCalendarOptions | undefined) => Promise<void>

Opens the system calendar app at the given date (today when omitted). Needs no calendar permission.

ParamType
options
OpenCalendarOptions

Since: 1.0.0


Interfacesโ€‹

CalendarPermissionStatusโ€‹

Permission state per calendar permission.

PropTypeDescriptionSince
readCalendar
PermissionState
Permission to read calendar events.1.0.0
writeCalendar
PermissionState
Permission to add events to the calendar.1.0.0

RequestPermissionsOptionsโ€‹

Options accepted by {@link CalendarPlugin.requestPermissions}.

PropTypeDescriptionSince
permissionsCalendarPermissionType[]The permissions to request. Both are requested when omitted.1.0.0

CreateEventResultโ€‹

Result of {@link CalendarPlugin.createEvent} and {@link CalendarPlugin.createEventInteractively}.

PropTypeDescriptionSince
idstringThe created event's id. Absent when the platform does not report it (Android's interactive editor).1.0.0

CreateEventOptionsโ€‹

Options accepted by {@link CalendarPlugin.createEvent} and {@link CalendarPlugin.createEventInteractively}, and the new values of {@link CalendarPlugin.modifyEvent}.

PropTypeDescriptionSince
titlestringThe event title.1.0.0
locationstringThe event location.1.0.0
notesstringFree-form event notes.1.0.0
startDatenumberEvent start as epoch milliseconds.1.0.0
endDatenumberEvent end as epoch milliseconds.1.0.0
isAllDaybooleanWhether the event lasts all day.1.0.0
calendarIdstringId of the calendar to create the event in. Takes precedence over calendarName; the default calendar is used when neither is set.1.0.0
calendarNamestringName of the calendar to create the event in.1.0.0
urlstringURL attached to the event. Android: the platform's event model has no URL field; the value is ignored.1.0.0
firstReminderMinutesnumberMinutes before the event for the first reminder.1.0.0
secondReminderMinutesnumberMinutes before the event for the second reminder.1.0.0
recurrence
EventRecurrence
Recurrence rule for a repeating event.1.0.0

EventRecurrenceโ€‹

Recurrence rule applied to a created event.

PropTypeDescriptionSince
frequency
RecurrenceFrequency
How often the event repeats.1.0.0
intervalnumberRepeat every interval periods of frequency (default 1).1.0.0
endDatenumberLast possible date of a repetition, as epoch milliseconds. Mutually exclusive with count; endDate wins when both are set.1.0.0
countnumberTotal number of repetitions.1.0.0

ModifyEventOptionsโ€‹

Options accepted by {@link CalendarPlugin.modifyEvent}.

PropTypeDescriptionSince
filter
EventFilter
Fields identifying the event to change.1.0.0
newEvent
Partial<CreateEventOptions>
New values to apply. Only the fields present are changed.1.0.0

EventFilterโ€‹

Fields used to locate the event to change in {@link CalendarPlugin.modifyEvent}. Set fields must all match.

PropTypeDescriptionSince
titlestringTitle substring to match (case-insensitive).1.0.0
locationstringLocation substring to match (case-insensitive).1.0.0
notesstringNotes substring to match (case-insensitive).1.0.0
startDatenumberStart of the date range as epoch milliseconds.1.0.0
endDatenumberEnd of the date range as epoch milliseconds.1.0.0
calendarNamestringRestrict the match to the calendar with this name.1.0.0

FindEventsResultโ€‹

Result of {@link CalendarPlugin.findEvents}.

PropTypeDescriptionSince
eventsCalendarEvent[]The events matching the search.1.0.0

CalendarEventโ€‹

A calendar event.

PropTypeDescriptionSince
idstringPlatform-assigned event id.1.0.0
titlestringThe event title.1.0.0
locationstringThe event location.1.0.0
notesstringFree-form event notes.1.0.0
startDatenumberEvent start as epoch milliseconds.1.0.0
endDatenumberEvent end as epoch milliseconds.1.0.0
isAllDaybooleanWhether the event lasts all day.1.0.0
calendarIdstringId of the calendar containing the event.1.0.0
calendarNamestringName of the calendar containing the event.1.0.0
attendeesEventAttendee[]The event's attendees. Absent when the event has none.1.0.0

EventAttendeeโ€‹

An attendee of a {@link CalendarEvent}.

PropTypeDescriptionSince
namestringThe attendee's display name.1.0.0
emailstringThe attendee's email address.1.0.0
status'unknown' | 'pending' | 'accepted' | 'declined' | 'tentative' | 'delegated' | 'completed' | 'in-process'The attendee's participation status.1.0.0

FindEventsOptionsโ€‹

Options accepted by {@link CalendarPlugin.findEvents}.

PropTypeDescriptionSince
titlestringTitle substring to match (case-insensitive).1.0.0
locationstringLocation substring to match (case-insensitive).1.0.0
notesstringNotes substring to match (case-insensitive).1.0.0
startDatenumberStart of the search range as epoch milliseconds. Defaults to the current time minus six months.1.0.0
endDatenumberEnd of the search range as epoch milliseconds. Defaults to the current time plus two years.1.0.0
calendarNamestringRestrict the search to the calendar with this name.1.0.0

DeleteEventOptionsโ€‹

Options accepted by {@link CalendarPlugin.deleteEvent}.

PropTypeDescriptionSince
idstringId of the event to delete. When set, the filter fields are ignored.1.0.0
fromDatenumberOnly with id, for a recurring event: keeps occurrences before this date (epoch milliseconds) and removes the rest of the series.1.0.0
titlestringTitle substring to match (case-insensitive).1.0.0
locationstringLocation substring to match (case-insensitive).1.0.0
notesstringNotes substring to match (case-insensitive).1.0.0
startDatenumberStart of the date range as epoch milliseconds.1.0.0
endDatenumberEnd of the date range as epoch milliseconds.1.0.0
calendarNamestringRestrict the match to the calendar with this name.1.0.0

ListCalendarsResultโ€‹

Result of {@link CalendarPlugin.listCalendars}.

PropTypeDescriptionSince
calendarsDeviceCalendar[]The calendars on the device.1.0.0

DeviceCalendarโ€‹

A calendar available on the device.

PropTypeDescriptionSince
idstringPlatform-assigned calendar id.1.0.0
namestringThe calendar name.1.0.0
displayNamestringName shown to the user, when the platform distinguishes it from name.1.0.0
isPrimarybooleanWhether this is the default calendar for new events.1.0.0

CreateCalendarResultโ€‹

Result of {@link CalendarPlugin.createCalendar}.

PropTypeDescriptionSince
idstringThe created calendar's id.1.0.0

CreateCalendarOptionsโ€‹

Options accepted by {@link CalendarPlugin.createCalendar}.

PropTypeDescriptionSince
namestringThe calendar name.1.0.0
colorstringCalendar color as a #RRGGBB hex string. The platform picks one when omitted.1.0.0

DeleteCalendarOptionsโ€‹

Options accepted by {@link CalendarPlugin.deleteCalendar}.

PropTypeDescriptionSince
namestringName of the calendar to delete.1.0.0

OpenCalendarOptionsโ€‹

Options accepted by {@link CalendarPlugin.openCalendar}.

PropTypeDescriptionSince
datenumberDate to show, as epoch milliseconds. Today when omitted.1.0.0

Type Aliasesโ€‹

PermissionStateโ€‹

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

CalendarPermissionTypeโ€‹

The individually requestable calendar permissions.

'readCalendar' | 'writeCalendar'

RecurrenceFrequencyโ€‹

How often a recurring event repeats.

'daily' | 'weekly' | 'monthly' | 'yearly'

Partialโ€‹

Make all properties in T optional

{ [P in keyof T]?: T[P]; }