@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/requestWriteOnlyAccessToEventson iOS 17+), never the deprecatedrequestAccess(to:).writeCalendaris satisfied by write-only access ("Add Events Only");readCalendarrequires full access. createEventInteractivelypresents the system event editor, which on iOS 17+ needs no calendar permission at all.- EventKit stores dates at second granularity, so
startDate/endDateread 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:
createEventInteractivelyopens 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.urlis ignored: the platform's event model has no URL field.
Errors
Every rejection carries a structured code + message:
| Code | Meaning |
|---|---|
OS-PLUG-CLDR-0000 | Unknown error |
OS-PLUG-CLDR-0001 | Invalid argument (e.g. no matching event) |
OS-PLUG-CLDR-0003 | Pending operation (e.g. editor already open) |
OS-PLUG-CLDR-0004 | I/O error |
OS-PLUG-CLDR-0005 | Not supported |
OS-PLUG-CLDR-0006 | Operation cancelled (editor closed) |
OS-PLUG-CLDR-0020 | Permission 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+.
| Param | Type |
|---|---|
options | |
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.
| Param | Type |
|---|---|
options | |
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.
| Param | Type |
|---|---|
options | |
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.
| Param | Type |
|---|---|
options | |
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.
| Param | Type |
|---|---|
options | |
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.
| Param | Type |
|---|---|
options | |
Since: 1.0.0
listCalendars()
listCalendars() => Promise<ListCalendarsResult>