@ebarooni/capacitor-calendar

中文文档
8.10.0发布于 2026/10/17MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 23.5万

A Capacitor plugin for native calendar events on iOS and Android (with reminders on iOS), and .ics event creation on the web.

原始使用文档
文档目录64 节
  1. Table of Contents
  2. Features and Platforms
  3. Demo
  4. Why this plugin?
  5. MCP Server
  6. Capacitor Compatibility
  7. Installation
  8. Setup
  9. Android
  10. iOS
  11. Official References
  12. Error codes
  13. Quick Start
  14. Usage Examples
  15. Create and download an event on the web
  16. Open the native event editor
  17. Modify or delete an event
  18. List events in a range
  19. Working with Calendars
  20. Create a Reminder (iOS only)
  21. Documentation
  22. Changelog
  23. Breaking Changes
  24. API
  25. checkPermission(...)
  26. checkAllPermissions()
  27. requestPermission(...)
  28. requestAllPermissions()
  29. requestWriteOnlyCalendarAccess()
  30. requestReadOnlyCalendarAccess()
  31. requestFullCalendarAccess()
  32. requestFullRemindersAccess()
  33. createEventWithPrompt(...)
  34. modifyEventWithPrompt(...)
  35. createEvent(...)
  36. modifyEvent(...)
  37. deleteEventsById(...)
  38. deleteEvent(...)
  39. deleteEventWithPrompt(...)
  40. listEventsInRange(...)
  41. commit()
  42. selectCalendarsWithPrompt(...)
  43. fetchAllCalendarSources()
  44. listCalendars()
  45. getDefaultCalendar(...)
  46. openCalendar(...)
  47. createCalendar(...)
  48. deleteCalendar(...)
  49. modifyCalendar(...)
  50. createRemindersList(...)
  51. deleteRemindersList(...)
  52. fetchAllRemindersSources()
  53. openReminders()
  54. getDefaultRemindersList()
  55. getRemindersLists()
  56. createReminder(...)
  57. deleteRemindersById(...)
  58. deleteReminder(...)
  59. modifyReminder(...)
  60. getReminderById(...)
  61. getRemindersFromLists(...)
  62. deleteReminderWithPrompt(...)
  63. updateRemindersList(...)
  64. Interfaces

@ebarooni/capacitor-calendar

capacitor-calendar-logo

@ebarooni/capacitor-calendar connects your Capacitor app to the native calendar. On iOS and Android, create, edit, and list events, and manage calendars and permissions. iOS also supports reminders. On the web, the plugin builds a downloadable .ics file; it does not write to a device calendar.

Table of Contents

Features and Platforms

CapabilityiOSAndroidWeb
Create, update, and delete events✅✅Create only*
Native prompts to create, edit, and delete events✅✅Create only*
List events in a date range✅✅–
Request calendar permissions✅✅–
List, create, modify, and delete calendars✅✅–
Open the native Calendar app✅✅–
Calendar sources and a calendar picker prompt✅––
Reminders and reminder lists✅––

* On the web, createEvent and createEventWithPrompt return a downloadable .ics file. They do not write to a device calendar. See Create and download an event on the web.

Demo

iOSAndroid

Web: Run the example app in a browser. Use Create event or Create event with prompt for .ics export. Unsupported actions are disabled.

Why this plugin?

  • Established. Available since Capacitor 5, with years of real-world use behind it.
  • Actively maintained. The original author still owns the codebase and ships fixes and features.
  • Fast support. Questions and bug reports get quick answers.
  • Lower vendor risk. Relying on one plugin author for everything is risky. Independent, focused maintainers keep your stack resilient.

MCP Server

@ebarooni/capacitor-calendar ships an official MCP server. It gives AI coding assistants accurate, grounded knowledge of the plugin.

docker run --rm -d --name capacitor-calendar-mcp -p 8080:8080 ghcr.io/ebarooni/capacitor-calendar-mcp:1.2.0

See mcp/README.md for client configuration and full details.

Capacitor Compatibility

Match the npm tag to your Capacitor major. The latest and latest-7 packages are intended to stay in feature parity.

Capacitornpm tagVersion
8.xlatestnpm@latest
7.xlatest-7npm@latest-7

Installation

Capacitor 8:

npm install @ebarooni/capacitor-calendar
# or: npm install @ebarooni/capacitor-calendar@latest
npx cap sync

Capacitor 7:

npm install @ebarooni/capacitor-calendar@latest-7
npx cap sync

Setup

This plugin works with native calendar APIs, so you need to configure permissions on each platform before you request access at runtime. After setup, see Quick Start to request permissions in code.

Android

Add these permissions to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

Request the matching runtime permissions before you read from or write to the calendar.

iOS

Add the appropriate usage description keys to ios/App/App/Info.plist. Starting with iOS 17, Apple requires separate keys for write-only and full calendar access.

<key>NSCalendarsUsageDescription</key>
<string>This app needs access to your calendar.</string>

<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
<string>This app needs permission to create calendar events.</string>

<key>NSCalendarsFullAccessUsageDescription</key>
<string>This app needs permission to read and manage your calendar events.</string>

<key>NSRemindersUsageDescription</key>
<string>This app needs access to your reminders.</string>

<key>NSRemindersFullAccessUsageDescription</key>
<string>This app needs permission to read and manage your reminders.</string>

[!IMPORTANT]
Only include the keys your app actually needs. If you only create events, you can omit the full access and reminders entries.

Official References

Error codes

On Android and iOS, a rejected call can expose error.code (stable category) and error.message (exact cause). Compare codes with the exported CapacitorCalendarErrorCode enum. Not every reject has a code yet; later releases add more catalog cases.

Defined codes:

CodeNameWhen
EB-CLDR-0001InvalidArgumentA required argument is missing or invalid.
EB-CLDR-0002NotFoundThe requested calendar, event, list, reminder, or calendar source does not exist.
EB-CLDR-0004IoErrorA calendar store read or write failed.
EB-CLDR-0005NotSupportedThe device cannot open the calendar UI, reminders UI, or target URL.
EB-CLDR-0020PermissionDeniedCalendar access was denied.
EB-CLDR-0100MissingDeclarationRequired Info.plist usage description or AndroidManifest permission is not set.

Android rejects a non-numeric or empty calendar or event id as InvalidArgument. iOS looks up the string in the system calendar store and may reject as NotFound when nothing matches.

IoError: Android and iOS map store failures such as failed create/delete ID retrieval and delete failures. Other calendar store errors that are not permission or launch failures also use this code. On iOS, EventKit store or system rejects use this code, including some authorization-related failures; Android permission-provider denials still use PermissionDenied (EB-CLDR-0020). On iOS, this code also covers the edit-prompt processFailed outcome.

NotSupported: Android maps a missing calendar activity handler (ActivityNotFoundException, for example openCalendar) to this code. iOS maps launch and URL failures (Failed to launch calendar app., reminders, Unable to open URL.).

On Android, calendar operations that fail with a permission error reject with PermissionDenied (EB-CLDR-0020). Permission check and request APIs still resolve "denied" on Android and iOS; they do not reject with 0020.

For Android and iOS wraps of system store, launch, and permission failures, the message starts with a fixed sentence. If the OS provides a different detail, it is appended in parentheses.

Quick Start

The sample below is for Android and iOS. For Web, see Create and download an event on the web.

import { CapacitorCalendar } from '@ebarooni/capacitor-calendar';

const { result } = await CapacitorCalendar.requestFullCalendarAccess();

if (result !== 'granted') {
  throw new Error('Calendar permission denied');
}

// Create an event starting in 1 hour, lasting 1 hour
const startDate = Date.now() + 60 * 60 * 1000;
const endDate = startDate + 60 * 60 * 1000;

const { id } = await CapacitorCalendar.createEvent({
  title: 'Product review',
  location: 'Office',
  startDate,
  endDate,
  description: 'Created with @ebarooni/capacitor-calendar',
});

console.log('Event created with ID:', id);

[!NOTE]
Dates are expected as Unix timestamps in milliseconds.

Usage Examples

Create and download an event on the web

On Web, createEvent and createEventWithPrompt build an .ics file. They do not write to a calendar store. Use autoDownloadIcsFile (defaults: false on createEvent, true on createEventWithPrompt) or downloadIcsFile. Permission APIs are unimplemented. For details, see MCP docs://web-behavior (mcp/README.md).

import { CapacitorCalendar } from '@ebarooni/capacitor-calendar';

const startDate = Date.now() + 60 * 60 * 1000;
const endDate = startDate + 60 * 60 * 1000;

const { ics } = await CapacitorCalendar.createEvent({
  title: 'Team standup',
  startDate,
  endDate,
  icsFileName: 'team-standup.ics',
  autoDownloadIcsFile: true,
});

Open the native event editor

Use the system calendar UI to let users create or edit events (on Web: confirm dialog + ICS):

await CapacitorCalendar.createEventWithPrompt({
  title: 'Planning session',
  location: 'Office',
  startDate: Date.now() + 24 * 60 * 60 * 1000,
  endDate: Date.now() + 25 * 60 * 60 * 1000,
});

[!NOTE]
On Android, this method always returns null for id. If you need the event ID, call listEventsInRange(...) afterward. On Web, cancel resolves with ics: null.

Modify or delete an event

The sample below is for Android and iOS. Use an id from createEvent or listEventsInRange:

await CapacitorCalendar.modifyEvent({
  id: eventId,
  title: 'Updated title',
});

await CapacitorCalendar.deleteEvent({
  id: eventId,
});

List events in a range

listEventsInRange returns events that overlap the given range, not only events that start or end inside it. Multi-day events that span the interval are included.

const now = Date.now();
const oneWeekLater = now + 7 * 24 * 60 * 60 * 1000;

const { result: events } = await CapacitorCalendar.listEventsInRange({
  from: now,
  to: oneWeekLater,
});

console.log('Upcoming events:', events);

To list events on a single day, use that day's bounds:

const startOfDay = new Date();
startOfDay.setHours(0, 0, 0, 0);
const startOfNextDay = new Date(startOfDay);
startOfNextDay.setDate(startOfNextDay.getDate() + 1);

const { result: todaysEvents } = await CapacitorCalendar.listEventsInRange({
  from: startOfDay.getTime(),
  to: startOfNextDay.getTime(),
});

Working with Calendars

// Get all calendars and default calendar
const { result: calendars } = await CapacitorCalendar.listCalendars();
const { result: defaultCalendar } = await CapacitorCalendar.getDefaultCalendar();

// Use default or fall back to first calendar
const targetCalendarId = defaultCalendar?.id ?? calendars[0]?.id;

[!NOTE]
On iOS you can also use selectCalendarsWithPrompt() to let the user pick calendars via the native interface.

Create a Reminder (iOS only)

const { result } = await CapacitorCalendar.requestFullRemindersAccess();

if (result === 'granted') {
  await CapacitorCalendar.createReminder({
    title: 'Send launch notes',
    dueDate: Date.now() + 2 * 24 * 60 * 60 * 1000,
    notes: 'Created with @ebarooni/capacitor-calendar',
  });
}

Documentation

The full documentation is generated from TypeScript definitions and is available online:

Changelog

See CHANGELOG.md for the latest updates and release history.

Breaking Changes

See BREAKING.md for breaking changes and migration steps.

API

checkPermission(...)

checkPermission(options: CheckPermissionOptions) => Promise<{ result: PermissionState; }>

Retrieves the current permission state for a given scope. On Android, readReminders and writeReminders resolve to "prompt".

ParamType
optionsCheckPermissionOptions

Returns: Promise<{ result: PermissionState; }>

Since: 0.1.0

Platform: Android, iOS


checkAllPermissions()

checkAllPermissions() => Promise<{ result: CheckAllPermissionsResult; }>

Retrieves the current state of all permissions. On Android, reminder keys always resolve to "prompt".

Returns: Promise<{ result: CheckAllPermissionsResult; }>

Since: 0.1.0

Platform: Android, iOS


requestPermission(...)

requestPermission(options: RequestPermissionOptions) => Promise<{ result: PermissionState; }>

Requests permission for a given scope. On Android, readReminders and writeReminders reject with Invalid scope.

ParamType
optionsRequestPermissionOptions

Returns: Promise<{ result: PermissionState; }>

Since: 0.1.0

Platform: Android, iOS


requestAllPermissions()

requestAllPermissions() => Promise<{ result: RequestAllPermissionsResult; }>

Requests permission for all calendar and reminder permissions. On Android, only calendar permissions are requested; reminder keys stay "prompt".

Returns: Promise<{ result: CheckAllPermissionsResult; }>

Since: 0.1.0

Platform: Android, iOS


requestWriteOnlyCalendarAccess()

requestWriteOnlyCalendarAccess() => Promise<{ result: PermissionState; }>

Requests write access to the calendar.

Returns: Promise<{ result: PermissionState; }>

Since: 5.4.0

Platform: Android, iOS


requestReadOnlyCalendarAccess()

requestReadOnlyCalendarAccess() => Promise<{ result: PermissionState; }>

Requests read access to the calendar.

Returns: Promise<{ result: PermissionState; }>

Since: 5.4.0

Platform: Android


requestFullCalendarAccess()

requestFullCalendarAccess() => Promise<{ result: PermissionState; }>

Requests read and write access to the calendar.

Returns: Promise<{ result: PermissionState; }>

Since: 5.4.0

Platform: Android, iOS


requestFullRemindersAccess()

requestFullRemindersAccess() => Promise<{ result: PermissionState; }>

Requests read and write access to the reminders. Resolves with "granted" or "denied" (never "prompt"). A grant covers both readReminders and writeReminders.

Returns: Promise<{ result: PermissionState; }>

Since: 5.4.0

Platform: iOS


createEventWithPrompt(...)

createEventWithPrompt(options?: CreateEventWithPromptOptions | undefined) => Promise<CreateEventWithPromptResult>

Opens a calendar UI to create an event. On Android and iOS, opens the system editor. On Android, id is always null. On Web, shows a confirm dialog, then builds an .ics File when the user confirms. See MCP docs://web-behavior for Web details.

ParamType
optionsCreateEventWithPromptOptions

Returns: Promise<CreateEventWithPromptResult>

Since: 0.1.0

Platform: Android, iOS, Web


modifyEventWithPrompt(...)

modifyEventWithPrompt(options: ModifyEventWithPromptOptions) => Promise<{ result: EventEditAction | null; }>

Opens a system calendar interface to modify an event. On Android always returns null.

ParamType
optionsModifyEventWithPromptOptions

Returns: Promise<{ result: EventEditAction | null; }>

Since: 6.6.0

Platform: Android, iOS


createEvent(...)

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

Creates an event in the calendar. On Android and iOS, inserts into the system calendar and returns its id. On Web, builds an .ics File as ics (no calendar store). See MCP docs://web-behavior.

ParamType
optionsCreateEventOptions

Returns: Promise<CreateEventResult>

Since: 0.4.0

Platform: Android, iOS, Web


modifyEvent(...)

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

Modifies an event.

ParamType
optionsModifyEventOptions

Since: 6.6.0

Platform: Android, iOS


deleteEventsById(...)

deleteEventsById(options: DeleteEventsByIdOptions) => Promise<{ result: DeleteEventsByIdResult; }>

Deletes multiple events.

ParamType
optionsDeleteEventsByIdOptions

Returns: Promise<{ result: DeleteEventsByIdResult; }>

Since: 0.11.0

Platform: Android, iOS


deleteEvent(...)

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

Deletes an event.

ParamType
optionsDeleteEventOptions

Since: 7.1.0

Platform: Android, iOS


deleteEventWithPrompt(...)

deleteEventWithPrompt(options: DeleteEventWithPromptOptions) => Promise<{ deleted: boolean; }>

Opens a dialog to delete an event.

ParamType
optionsDeleteEventWithPromptOptions

Returns: Promise<{ deleted: boolean; }>

Since: 7.1.0

Platform: Android, iOS


listEventsInRange(...)

listEventsInRange(options: ListEventsInRangeOptions) => Promise<ListEventsInRangeResult>

Retrieves events that overlap a date range.

An event is included when its time interval intersects [from, to], including multi-day events that span the range without starting or ending inside it.

ParamType
optionsListEventsInRangeOptions

Returns: Promise<ListEventsInRangeResult>

Since: 0.10.0

Platform: Android, iOS


commit()

commit() => Promise<void>

Saves pending calendar changes.

Since: 7.1.0

Platform: iOS


selectCalendarsWithPrompt(...)

selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions | undefined) => Promise<SelectCalendarsWithPromptResult>

Opens a system interface to choose one or multiple calendars.

Calendar access is expected. Call requestFullCalendarAccess() first. Without authorization the chooser can look empty.

On confirm, result contains the calendars the user selected. On cancel, result is an empty array.

If a chooser is already presented, a new call is rejected; the in-flight call continues until the user confirms or cancels.

ParamType
optionsSelectCalendarsWithPromptOptions

Returns: Promise<SelectCalendarsWithPromptResult>

Since: 0.2.0

Platform: iOS


fetchAllCalendarSources()

fetchAllCalendarSources() => Promise<FetchAllCalendarSourcesResult>

Retrieves a list of calendar sources.

Requires calendar access. Without authorization, result is typically an empty array. This method does not reject solely for missing permission.

Returns: Promise<FetchAllCalendarSourcesResult>

Since: 6.6.0

Platform: iOS


listCalendars()

listCalendars() => Promise<ListCalendarsResult>

Retrieves a list of all available calendars.

Requires calendar read access. On Android, missing permission typically rejects. On iOS, missing authorization typically returns an empty result.

Returns: Promise<ListCalendarsResult>

Since: 7.1.0

Platform: Android, iOS


getDefaultCalendar(...)

getDefaultCalendar(options?: GetDefaultCalendarOptions | undefined) => Promise<{ result: Calendar | null; }>

Retrieves the default calendar.

Requires calendar read access. On Android, missing permission typically rejects. On iOS, missing authorization typically yields result: null.

The system default is the primary calendar on Android and defaultCalendarForNewEvents on iOS. When neither exists and useFallbackCalendar is true, the first available calendar is returned. Otherwise the method returns null when there is no system default.

ParamType
optionsGetDefaultCalendarOptions

Returns: Promise<{ result: Calendar | null; }>

Since: 0.3.0

Platform: Android, iOS


openCalendar(...)

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

Opens the calendar app.

ParamType
optionsOpenCalendarOptions

Since: 7.1.0

Platform: Android, iOS


createCalendar(...)

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

Creates a calendar.

title is required. color is optional and defaults to #007AFF. On Android, accountName and ownerAccount are required at runtime.

ParamType
optionsCreateCalendarOptions

Returns: Promise<CreateCalendarResult>

Since: 5.2.0

Platform: Android, iOS


deleteCalendar(...)

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

Deletes a calendar by id.

ParamType
optionsDeleteCalendarOptions

Since: 5.2.0

Platform: Android, iOS


modifyCalendar(...)

modifyCalendar(options: ModifyCalendarOptions) => Promise<void>

Modifies a calendar with options.

ParamType
optionsModifyCalendarOptions

Since: 7.2.0

Platform: Android, iOS


createRemindersList(...)

createRemindersList(options: CreateRemindersListOptions) => Promise<CreateRemindersListResult>

Creates a new reminders list.

ParamType
optionsCreateRemindersListOptions

Returns: Promise<CreateRemindersListResult>

Since: 8.1.0

Platform: iOS


deleteRemindersList(...)

deleteRemindersList(options: DeleteRemindersListOptions) => Promise<void>

Deletes a reminders list.

ParamType
optionsDeleteRemindersListOptions

Since: 8.2.0

Platform: iOS


fetchAllRemindersSources()

fetchAllRemindersSources() => Promise<FetchAllCalendarSourcesResult>

Retrieves a list of calendar sources.

Returns: Promise<FetchAllCalendarSourcesResult>

Since: 6.6.0

Platform: iOS


openReminders()

openReminders() => Promise<void>

Opens the reminders app.

Since: 7.1.0

Platform: iOS


getDefaultRemindersList()

getDefaultRemindersList() => Promise<GetDefaultRemindersListResult>

Retrieves the default reminders list.

Returns: Promise<GetDefaultRemindersListResult>

Since: 7.1.0

Platform: iOS


getRemindersLists()

getRemindersLists() => Promise<GetRemindersListsResult>

Retrieves all available reminders lists.

Returns: Promise<GetRemindersListsResult>

Since: 7.1.0

Platform: iOS


createReminder(...)

createReminder(options: CreateReminderOptions) => Promise<CreateReminderResult>

Creates a reminder.

ParamType
optionsCreateReminderOptions

Returns: Promise<CreateReminderResult>

Since: 0.5.0

Platform: iOS


deleteRemindersById(...)

deleteRemindersById(options: DeleteRemindersByIdOptions) => Promise<{ result: DeleteRemindersByIdResult; }>

Deletes multiple reminders.

ParamType
optionsDeleteRemindersByIdOptions

Returns: Promise<{ result: DeleteRemindersByIdResult; }>

Since: 5.3.0

Platform: iOS


deleteReminder(...)

deleteReminder(options: DeleteReminderOptions) => Promise<void>

Deletes a reminder.

ParamType
optionsDeleteReminderOptions

Since: 7.1.0

Platform: iOS


modifyReminder(...)

modifyReminder(options: ModifyReminderOptions) => Promise<void>

Modifies a reminder.

ParamType
optionsModifyReminderOptions

Since: 6.7.0

Platform: iOS


getReminderById(...)

getReminderById(options: GetReminderByIdOptions) => Promise<GetReminderByIdResult>

Retrieves a reminder by id.

ParamType
optionsGetReminderByIdOptions

Returns: Promise<GetReminderByIdResult>

Since: 7.1.0

Platform: iOS


getRemindersFromLists(...)

getRemindersFromLists(options: GetRemindersFromListsOptions) => Promise<GetRemindersFromListsResult>

Retrieves reminders from multiple lists.

ParamType
optionsGetRemindersFromListsOptions

Returns: Promise<GetRemindersFromListsResult>

Since: 5.3.0

Platform: iOS


deleteReminderWithPrompt(...)

deleteReminderWithPrompt(options: DeleteReminderWithPromptOptions) => Promise<DeleteReminderWithPromptResult>

Opens a dialog to delete a reminder.

ParamType
optionsDeleteReminderWithPromptOptions

Returns: Promise<DeleteReminderWithPromptResult>

Since: 7.2.0

Platform: iOS


updateRemindersList(...)

updateRemindersList(options: UpdateRemindersListOptions) => Promise<UpdateRemindersListResult>

Updates a reminders list.

ParamType
optionsUpdateRemindersListOptions

Returns: Promise<UpdateRemindersListResult>

Since: 8.2.0

Platform: iOS


Interfaces

CheckPermissionOptions

Options for {@link CalendarAccess#checkPermission}.

PropTypeDescriptionSincePlatform
scopeCalendarPermissionScopeThe permission scope to check. On Android, readReminders and writeReminders resolve to "prompt" (reminders are not supported on Android).8.3.1Android, iOS

RequestPermissionOptions

Options for {@link CalendarAccess#requestPermission}.

PropTypeDescriptionSincePlatform
scopeCalendarPermissionScopeThe permission scope to request.8.3.1Android, iOS

CreateEventWithPromptResult

PropTypeDescriptionSincePlatform
icsFile | nullAn .ics file (text/calendar) with one VEVENT. Always null on Android and iOS. On Web, set when the user confirms; null when the user cancels.8.8.0Web
idstring | nullThe identifier of the created event. Always null on Android and Web. Present on iOS when the user saves.0.1.0Android, iOS

CreateEventWithPromptOptions

PropTypeDescriptionDefaultSincePlatform
alertsnumber[]Alert times in minutes relative to the event start. Use negative numbers for reminders before the start, and positive numbers for reminders after the start. On iOS only 2 alerts are supported.7.1.0iOS, Web
autoDownloadIcsFilebooleanStart a browser download of the ICS file.true8.8.0Web
availabilityEventAvailability7.1.0Android, iOS, Web
calendarIdstring0.1.0iOS
descriptionstring7.1.0Android, iOS, Web
endDatenumber0.1.0Android, iOS, Web
icsFileNamestringDownload filename for the .ics file. When omitted, a name is derived from title (fallback event.ics). If the value has no .ics extension, .ics is appended.8.8.0Web
inviteesstring[]An array of emails to invite.7.1.0Android
isAllDayboolean0.1.0Android, iOS, Web
locationstring0.1.0Android, iOS, Web
promptMessagestringConfirm dialog message. When omitted, the dialog uses the event title and time summary.8.8.0Web
recurrenceEventRecurrenceRuleRules for creating a recurring event.7.3.0Android, iOS, Web
startDatenumber0.1.0Android, iOS, Web
titlestring0.1.0Android, iOS, Web
urlstring0.1.0iOS, Web

EventRecurrenceRule

PropTypeDescriptionDefaultSincePlatform
byMonthnumber[]Limits a yearly recurrence to specific months of the year. The values should be between 1 and 12.7.1.0Android, iOS, Web
byMonthDaynumber[]Limits a monthly recurrence to specific days of the month. The values should be between 1 and 31.7.1.0Android, iOS, Web
byWeekDaynumber[]Limits a weekly recurrence to specific weekdays. The values should be between 1 and 7. 1 means Monday and 7 means Sunday.7.3.0Android, iOS, Web
countnumberThe total number of occurrences. If set, the recurrence ends after this many occurrences. If count is provided, end is ignored.7.3.0Android, iOS, Web
daysOfTheYearnumber[]Limits a yearly recurrence to specific days of the year (1 to 366).7.3.0iOS, Web
endnumberEnd date of the recurrence series as a Unix timestamp in milliseconds.7.1.0Android, iOS, Web
frequencyRecurrenceFrequencyHow often the event repeats.7.3.0Android, iOS, Web
intervalnumberThe interval between recurrences. Use in combination with frequency. For example, a weekly event with an interval of 2, results in the event occurring every 2 weeks.17.3.0Android, iOS, Web
weeksOfTheYearnumber[]Limits a yearly recurrence to specific ISO week numbers (1 to 53).7.3.0iOS, Web

ModifyEventWithPromptOptions

PropTypeDescriptionSincePlatform
alertsnumber[]Alert times in minutes relative to the event start. Use negative numbers for reminders before the start, and positive numbers for reminders after the start. On iOS only 2 alerts are supported.7.1.0iOS
availabilityEventAvailability7.1.0Android, iOS
calendarIdstring0.1.0iOS
descriptionstring7.1.0Android, iOS
endDatenumber0.1.0Android, iOS
idstringThe ID of the event to be modified.7.1.0Android, iOS
inviteesstring[]An array of emails to invite.7.1.0Android
isAllDayboolean0.1.0Android, iOS
locationstring0.1.0Android, iOS
recurrenceEventRecurrenceRuleRules for creating a recurring event.7.3.0Android, iOS
startDatenumber0.1.0Android, iOS
titlestring0.1.0Android, iOS
urlstring0.1.0iOS

CreateEventResult

PropTypeDescriptionSincePlatform
icsFile | nullAn .ics file (text/calendar) with one VEVENT. Always null on Android and iOS.8.5.0Web
idstring | nullThe identifier of the created event. Always null on Web. Present on Android and iOS after a successful create.0.4.0Android, iOS

CreateEventOptions

PropTypeDescriptionDefaultSincePlatform
alertsnumber[]Alert times in minutes relative to the event start. Use negative numbers for alerts before the start, and positive numbers for alerts after the start.7.1.0Android, iOS, Web
attendeesEventGuest[]The event guests.7.1.0Android, Web
autoDownloadIcsFilebooleanStart a browser download of the ICS file.false8.8.0Web
availabilityEventAvailability7.1.0Android, iOS, Web
calendarIdstring0.1.0Android, iOS
colorstring7.1.0Android
commitbooleanWhether to save immediately (true) or batch changes for later (false).true7.1.0iOS
descriptionstring7.1.0Android, iOS, Web
durationstringDuration of the event in RFC2445 format. On Web, used when endDate is omitted; endDate wins if both are set.7.1.0Android, Web
endDatenumber0.1.0Android, iOS, Web
icsFileNamestringDownload filename for the .ics file. When omitted, a name is derived from title (fallback event.ics). If the value has no .ics extension, .ics is appended.8.5.0Web
isAllDayboolean0.1.0Android, iOS, Web
locationstring0.1.0Android, iOS, Web
organizerstringEmail of the event organizer.7.1.0Android, Web
recurrenceEventRecurrenceRuleRules for creating a recurring event.7.3.0Android, iOS, Web
startDatenumber0.1.0Android, iOS, Web
titlestring0.4.0Android, iOS, Web
urlstring0.1.0iOS, Web

EventGuest

PropTypeSince
namestring7.1.0
emailstring7.1.0

ModifyEventOptions

PropTypeDescriptionDefaultSincePlatform
alertsnumber[]Alert times in minutes relative to the event start. Use negative numbers for alerts before the start, and positive numbers for alerts after the start.7.1.0Android, iOS
attendeesEventGuest[]The event guests.7.1.0Android
availabilityEventAvailability7.1.0Android, iOS
calendarIdstring0.1.0Android, iOS
colorstring7.1.0Android
descriptionstring7.1.0Android, iOS
durationstringDuration of the event in RFC2445 format.7.1.0Android
endDatenumber0.1.0Android, iOS
idstringThe ID of the event to be modified.7.1.0Android, iOS
isAllDayboolean0.1.0Android, iOS
locationstring0.1.0Android, iOS
recurrenceEventRecurrenceRuleRules for creating a recurring event.7.3.0Android, iOS
organizerstringEmail of the event organizer.

版本与发布记录

@ebarooni/capacitor-calendar 共发布 56 个版本,首次发布于 2024/02/25;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.10.0latest2026/10/1727 天前
7.5.0latest-72026/10/1727 天前
8.9.02026/10/111 个月前
7.4.02026/10/111 个月前
8.8.02026/10/051 个月前
7.3.02026/10/051 个月前

其他发布通道:latest-5 → 5.5.0,latest-7 → 7.5.0。

关于 @ebarooni/capacitor-calendar 的常见问题

@ebarooni/capacitor-calendar 是什么?

A Capacitor plugin for native calendar events on iOS and Android (with reminders on iOS), and .ics event creation on the web.

如何安装 @ebarooni/capacitor-calendar?

在项目目录运行 npm install @ebarooni/capacitor-calendar,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ebarooni/capacitor-calendar 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ebarooni/capacitor-calendar 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ebarooni/capacitor-calendar 可以商用吗?

@ebarooni/capacitor-calendar 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ebarooni/capacitor-calendar 的下载量有多少?

根据 npm 官方下载统计,@ebarooni/capacitor-calendar 在 2026/10/13 – 2026/11/11 这 30 天内被下载 235,242 次,日均约 7,841 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ebarooni/capacitor-calendar 还在维护吗?

最新版本 8.10.0 发布于 2026/10/17(27 天前);至今共发布 56 个版本,其中过去 12 个月发布了 17 个;首次发布于 2024/02/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。