Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ebarooni/capacitor-calendar

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebarooni/capacitor-calendar

The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.

  • 0.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
increased by108.86%
Maintainers
1
Weekly downloads
 
Created
Source

CapacitorCalendar

The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.

https://capacitor-calendar.pages.dev

Table of Contents

Install

npm install @ebarooni/capacitor-calendar
npx cap sync

Support Range

Platformrange
iOS≥ 13
Android≥ 7 (SDK 24 or Nougat)

Demo (click for details)

iOS 17Android 14

On iOS, readCalendar permission is not needed when you a

re creating an event using the native prompt. The video is just for showing the functionality, otherwise the createEventWithPrompt method works without the readCalendar authorization.

MVP

  • ✅ Choose calendars with prompt (only supported on iOS)
  • ✅ Get list of available calendars
  • ✅ Get default calendar
  • ✅ Create calendar events without native prompts
  • ⌛️ Create reminders (only supported on iOS)
  • ⌛️ Find calendar events
  • ⌛️ Delete calendar events

Permissions

To be able to use the plugin, you will need to add the required permissions to your app. The required platform-specific permissions can be found below:

API

checkPermission(...)

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

Checks the current authorization status of a specific permission.

ParamTypeDescription
options{ alias: PluginPermission; }An object with the name of the permission

Returns: Promise<{ result: PermissionState; }>


checkAllPermissions()

checkAllPermissions() => Promise<PluginPermissionsMap>

Checks the current authorization status of all the required permissions for the plugin.

Returns: Promise<PluginPermissionsMap>


requestPermission(...)

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

Requests authorization to a specific permission, if not already granted. If the permission is already granted, it will directly return the status.

ParamTypeDescription
options{ alias: PluginPermission; }An object with the name of the permission

Returns: Promise<{ result: PermissionState; }>


requestAllPermissions()

requestAllPermissions() => Promise<PluginPermissionsMap>

Requests authorization to all the required permissions for the plugin, if they have not already been granted.

Returns: Promise<PluginPermissionsMap>


createEventWithPrompt()

createEventWithPrompt() => Promise<{ eventCreated: boolean; }>

Creates an event in the calendar by using the native calendar. On iOS opens a native sheet and on Android opens an intent. This method does not need any read or write authorization from the user on iOS. However, the entries in the Info.plist file are still needed. On Android, the user has to authorize for read access.

Returns: Promise<{ eventCreated: boolean; }>


selectCalendarsWithPrompt(...)

selectCalendarsWithPrompt(options: { displayStyle: CalendarChooserDisplayStyle; selectionStyle: CalendarChooserSelectionStyle; }) => Promise<{ result: Calendar[]; }>

Presents a prompt to the user to select calendars. This method is available only on iOS.

ParamTypeDescription
options{ displayStyle: CalendarChooserDisplayStyle; selectionStyle: CalendarChooserSelectionStyle; }- Options for customizing the display and selection styles of the calendar chooser.

Returns: Promise<{ result: Calendar[]; }>


listCalendars()

listCalendars() => Promise<{ result: Calendar[]; }>

Retrieves a list of calendars available on the device.

Returns: Promise<{ result: Calendar[]; }>


getDefaultCalendar()

getDefaultCalendar() => Promise<{ result: Calendar; }>

Retrieves the default calendar set on the device.

Returns: Promise<{ result: Calendar; }>


createEvent(...)

createEvent(options: { title: string; calendarId?: string; location?: string; startDate?: Date; endDate?: Date; isAllDay?: boolean; }) => Promise<{ eventCreated: boolean; }>

Creates an event with the provided options.

ParamTypeDescription
options{ title: string; calendarId?: string; location?: string; startDate?: Date; endDate?: Date; isAllDay?: boolean; }- Options for creating the event.

Returns: Promise<{ eventCreated: boolean; }>


getDefaultRemindersList()

getDefaultRemindersList() => Promise<{ result: RemindersList; }>

Retrieves the default reminders list set on the device.

Returns: Promise<{ result: RemindersList; }>


getRemindersLists()

getRemindersLists() => Promise<{ result: RemindersList[]; }>

Retrieves all available reminders lists on the device.

Returns: Promise<{ result: RemindersList[]; }>


createReminder(...)

createReminder(options: { title: string; listId?: string; priority?: number; isCompleted?: boolean; startDate?: number; dueDate?: number; completionDate?: number; notes?: string; url?: string; location?: string; recurrence?: ReminderRecurrenceRule; }) => Promise<{ reminderCreated: boolean; }>

Creates a reminder with the provided options.

ParamTypeDescription
options{ title: string; listId?: string; priority?: number; isCompleted?: boolean; startDate?: number; dueDate?: number; completionDate?: number; notes?: string; url?: string; location?: string; recurrence?: ReminderRecurrenceRule; }- Options for creating the reminder.

Returns: Promise<{ reminderCreated: boolean; }>


Interfaces

PluginPermissionsMap
Calendar

Represents a calendar object with an ID and title.

PropType
idstring
titlestring
Date

Enables basic storage and retrieval of dates and times.

MethodSignatureDescription
toString() => stringReturns a string representation of a date. The format of the string depends on the locale.
toDateString() => stringReturns a date as a string value.
toTimeString() => stringReturns a time as a string value.
toLocaleString() => stringReturns a value as a string value appropriate to the host environment's current locale.
toLocaleDateString() => stringReturns a date as a string value appropriate to the host environment's current locale.
toLocaleTimeString() => stringReturns a time as a string value appropriate to the host environment's current locale.
valueOf() => numberReturns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
getTime() => numberGets the time value in milliseconds.
getFullYear() => numberGets the year, using local time.
getUTCFullYear() => numberGets the year using Universal Coordinated Time (UTC).
getMonth() => numberGets the month, using local time.
getUTCMonth() => numberGets the month of a Date object using Universal Coordinated Time (UTC).
getDate() => numberGets the day-of-the-month, using local time.
getUTCDate() => numberGets the day-of-the-month, using Universal Coordinated Time (UTC).
getDay() => numberGets the day of the week, using local time.
getUTCDay() => numberGets the day of the week using Universal Coordinated Time (UTC).
getHours() => numberGets the hours in a date, using local time.
getUTCHours() => numberGets the hours value in a Date object using Universal Coordinated Time (UTC).
getMinutes() => numberGets the minutes of a Date object, using local time.
getUTCMinutes() => numberGets the minutes of a Date object using Universal Coordinated Time (UTC).
getSeconds() => numberGets the seconds of a Date object, using local time.
getUTCSeconds() => numberGets the seconds of a Date object using Universal Coordinated Time (UTC).
getMilliseconds() => numberGets the milliseconds of a Date, using local time.
getUTCMilliseconds() => numberGets the milliseconds of a Date object using Universal Coordinated Time (UTC).
getTimezoneOffset() => numberGets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
setTime(time: number) => numberSets the date and time value in the Date object.
setMilliseconds(ms: number) => numberSets the milliseconds value in the Date object using local time.
setUTCMilliseconds(ms: number) => numberSets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
setSeconds(sec: number, ms?: number | undefined) => numberSets the seconds value in the Date object using local time.
setUTCSeconds(sec: number, ms?: number | undefined) => numberSets the seconds value in the Date object using Universal Coordinated Time (UTC).
setMinutes(min: number, sec?: number | undefined, ms?: number | undefined) => numberSets the minutes value in the Date object using local time.
setUTCMinutes(min: number, sec?: number | undefined, ms?: number | undefined) => numberSets the minutes value in the Date object using Universal Coordinated Time (UTC).
setHours(hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => numberSets the hour value in the Date object using local time.
setUTCHours(hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => numberSets the hours value in the Date object using Universal Coordinated Time (UTC).
setDate(date: number) => numberSets the numeric day-of-the-month value of the Date object using local time.
setUTCDate(date: number) => numberSets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
setMonth(month: number, date?: number | undefined) => numberSets the month value in the Date object using local time.
setUTCMonth(month: number, date?: number | undefined) => numberSets the month value in the Date object using Universal Coordinated Time (UTC).
setFullYear(year: number, month?: number | undefined, date?: number | undefined) => numberSets the year of the Date object using local time.
setUTCFullYear(year: number, month?: number | undefined, date?: number | undefined) => numberSets the year value in the Date object using Universal Coordinated Time (UTC).
toUTCString() => stringReturns a date converted to a string using Universal Coordinated Time (UTC).
toISOString() => stringReturns a date as a string value in ISO format.
toJSON(key?: any) => stringUsed by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.
RemindersList
ReminderRecurrenceRule
PropTypeDescription
frequencyReminderRecurrenceFrequencyHow frequent should the reminder repeat.
intervalnumberThe interval should be a number greater than 0. For values lower than 1 the method will throw an error.
endnumberWhen provided, the reminder will stop repeating at the given time.

Type Aliases

PermissionState

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

Enums

PluginPermission
MembersValueDescription
READ_CALENDAR'readCalendar'Represents the permission state for reading calendar.
WRITE_CALENDAR'writeCalendar'Represents the permission state for writing calendar.
READ_REMINDERS'readReminders'Represents the permission state for reading reminders.
WRITE_REMINDERS'writeReminders'Represents the permission state for writing reminders.
CalendarChooserDisplayStyle
MembersDescription
ALL_CALENDARSDisplay all calendars available for selection.
WRITABLE_CALENDARS_ONLYDisplay only writable calendars available for selection.
CalendarChooserSelectionStyle
MembersDescription
SINGLEAllows only a single selection in the calendar chooser.
MULTIPLEAllows multiple selections in the calendar chooser.
ReminderRecurrenceFrequency
Members
DAILY
WEEKLY
MONTHLY
YEARLY

Keywords

FAQs

Package last updated on 18 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc