始め方
このプラグインのインストール手順とフル マークダウン ガイドを含むセットアップの案内をコピーする。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-calendar`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/calendar/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAI-Assistedセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-calendar` plugin in my project.Manualセットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
npm install @capgo/capacitor-calendarnpx cap synciOS セットアップ
iOS セットアップのセクション__CAPGO_KEEP_0__の使用方法を追加します。 ios/App/App/Info.plist:
<key>NSCalendarsUsageDescription</key><string>This app needs calendar access.</string><key>NSCalendarsWriteOnlyAccessUsageDescription</key><string>This app needs permission to add calendar events.</string><key>NSCalendarsFullAccessUsageDescription</key><string>This app needs permission to read and manage calendar events.</string><key>NSRemindersUsageDescription</key><string>This app needs reminders access.</string><key>NSRemindersFullAccessUsageDescription</key><string>This app needs permission to read and manage reminders.</string>iOS 17 以降では、書き込み専用とフル カレンダー アクセスを区別します。リマインダー API を呼び出す場合のみ、リマインダー使用方法を含めます。
Apple の参考資料: 最新のカレンダー アクセス レベルへの移行.
Android セットアップ
Android セットアップのセクション__CAPGO_KEEP_0__のカレンダー権限を追加します。 android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_CALENDAR" /><uses-permission android:name="android.permission.WRITE_CALENDAR" />Android の参考資料: カレンダー プロバイダーのユーザー権限.
カレンダー アクセスを要求する
「カレンダー アクセスを要求する」セクションimport { CapacitorCalendar } from '@capgo/capacitor-calendar';
const permission = await CapacitorCalendar.requestFullCalendarAccess();
if (permission.result !== 'granted') { throw new Error('Calendar permission was not granted');}イベントを追加するだけのアプリでは、 requestWriteOnlyCalendarAccess()Android でのみ読み取りフローを使用する場合、 requestReadOnlyCalendarAccess().
イベントを作成する
「イベントを作成する」セクション日付はミリ秒単位の Unix タイムスタンプです。
import { CapacitorCalendar } from '@capgo/capacitor-calendar';
const startDate = Date.now() + 60 * 60 * 1000;const endDate = startDate + 60 * 60 * 1000;
const { id } = await CapacitorCalendar.createEvent({ title: 'Product review', location: 'Capgo', startDate, endDate, description: 'Created with @capgo/capacitor-calendar',});
console.log('Created event', id);ネイティブ イベント エディターを開く
「ネイティブ イベント エディターを開く」セクションawait CapacitorCalendar.createEventWithPrompt({ title: 'Planning session', location: 'Office', startDate: Date.now() + 24 * 60 * 60 * 1000, endDate: Date.now() + 25 * 60 * 60 * 1000,});Android上では、プロンプトベースの作成と修正の呼び出しは null必要に応じて作成されたイベントIDを探す場合にイベントをリストアップします。
来週のイベント
「来週のイベント」タイトルのセクションconst now = Date.now();const oneWeekFromNow = now + 7 * 24 * 60 * 60 * 1000;
const { result: events } = await CapacitorCalendar.listEventsInRange({ from: now, to: oneWeekFromNow,});カレンダーを選択
「カレンダーを選択」タイトルのセクションconst { result: calendars } = await CapacitorCalendar.listCalendars();const { result: defaultCalendar } = await CapacitorCalendar.getDefaultCalendar();
const calendarId = defaultCalendar?.id ?? calendars[0]?.id;selectCalendarsWithPrompt() iOSでシステムカレンダーピッカーを表示したい場合に利用可能です。
iOS用のリマインダーを作成
「iOS用のリマインダーを作成」タイトルのセクションconst permission = await CapacitorCalendar.requestFullRemindersAccess();
if (permission.result === 'granted') { await CapacitorCalendar.createReminder({ title: 'Send launch notes', dueDate: Date.now() + 2 * 24 * 60 * 60 * 1000, notes: 'Created with @capgo/capacitor-calendar', });}リマインダー API は iOS 限定です。
例のアプリ
「例のアプリ」のセクションリポジトリには、許可チェック、イベントの作成、ネイティブ イベントの提示、カレンダーのリスト表示、イベントの範囲リスト表示などを含む Capacitor の例のアプリが含まれます。
| iOS | Android |
|---|---|
![]() | ![]() |
API のリファレンス
「API のリファレンス」のセクションAPI の完全なリファレンスは、パッケージの README と TypeScript の定義で管理されています。

