Calendar

Improve this doc

$ ionic plugin add cordova-plugin-calendar

Repo: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin

This plugin allows you to add events to the Calendar of the mobile device.

Requires Cordova plugin: cordova-plugin-calendar. For more info, please see the Calendar plugin docs.

Supported platforms

Static Methods

createCalendar(nameOrOptions)

Create a calendar. (iOS only)

Param Type Details
nameOrOptions string|Object

either a string name or a options object. options: calendarName: string the name of the calendar calendarColor: string the hex color of the calendar

Returns: Returns a Promise

deleteCalendar(name)

Delete a calendar. (iOS only)

Param Type Details
name string

Name of the calendar to delete.

Returns: Returns a Promise

getCalendarOptions()

Returns the default calendar options.

Returns: Returns an object with the default calendar options: firstReminderMinutes: 60, secondReminderMinutes: null, recurrence: null, // options are: ‘daily’, ‘weekly’, ‘monthly’, ‘yearly’ recurrenceInterval: 1, // only used when recurrence is set recurrenceEndDate: null, calendarName: null, calendarId: null, url: null

createEvent(title, location, notes, startDate, endDate)

Silently create an event.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

Returns: Returns a Promise

createEventWithOptions(title, location, notes, startDate, endDate, options)

Silently create an event with additional options.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

options CalendarOptions

Additional options, see getCalendarOptions

Returns: Returns a Promise

createEventInteractively(title, location, notes, startDate, endDate)

Interactively create an event.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

Returns: Returns a Promise

createEventInteractivelyWithOptions(title, location, notes, startDate, endDate, options)

Interactively create an event with additional options.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

options CalendarOptions

Additional options, see getCalendarOptions

Returns: Returns a Promise

findEvent(title, location, notes, startDate, endDate)

Find an event.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

Returns: Returns a Promise

findEventWithOptions(title, location, notes, startDate, endDate, options)

Find an event with additional options.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

options CalendarOptions

Additional options, see getCalendarOptions

Returns: Returns a Promise that resolves with the event, or rejects with an error.

listEventsInRange(startDate, endDate)

Find a list of events within the specified date range. (Android only)

Param Type Details
startDate Date

The start date

endDate Date

The end date

Returns: Returns a Promise that resolves with the list of events, or rejects with an error.

listCalendars()

Get a list of all calendars.

Returns: A Promise that resolves with the list of calendars, or rejects with an error.

findAllEventsInNamedCalendar()

Get a list of all future events in the specified calendar. (iOS only)

Returns: Returns a Promise that resolves with the list of events, or rejects with an error.

modifyEvent(title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate)

Modify an event. (iOS only)

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

newTitle string

The new event title

newLocation string

The new event location

newNotes string

The new event notes

newStartDate Date

The new event start date

newEndDate Date

The new event end date

Returns: Returns a Promise

modifyEventWithOptions(title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, options)

Modify an event with additional options. (iOS only)

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

newTitle string

The new event title

newLocation string

The new event location

newNotes string

The new event notes

newStartDate Date

The new event start date

newEndDate Date

The new event end date

options CalendarOptions

Additional options, see getCalendarOptions

Returns: Returns a Promise

deleteEvent(title, location, notes, startDate, endDate)

Delete an event.

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

Returns: Returns a Promise

deleteEventFromNamedCalendar(title, location, notes, startDate, endDate, calendarName)

Delete an event from the specified Calendar. (iOS only)

Param Type Details
title string

The event title

location string

The event location

notes string

The event notes

startDate Date

The event start date

endDate Date

The event end date

calendarName string

Returns: Returns a Promise

openCalendar()

Open the calendar at the specified date.

Returns: Date date

Instance Methods

id()

name()

API

Native

General