Search docs/

Calendar

v5.1.5

Contents

The Calendar plugin allows you to add events to the system calendar of the mobile device.

Index

Classes

Interfaces


Classes

Calendar

Calendar:

name: Calendar

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

usage:

import { Calendar } from '@ionic-enterprise/calendar/ngx';

constructor(private calendar: Calendar) { }

this.calendar.createCalendar('MyCalendar').then(
  (msg) => { console.log(msg); },
  (err) => { console.log(err); }
);

interfaces: CalendarOptions NameOrOptions

createCalendar

createCalendar(nameOrOptions: string | NameOrOptions): Promise<any>

Create a calendar. (iOS only)

Parameters:

Name Type Description
nameOrOptions string | NameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string

Returns: Promise<any> Returns a Promise


createEvent

createEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>

Silently create an event.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date

Returns: Promise<any> Returns a Promise


createEventInteractively

createEventInteractively(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>

Interactively create an event.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date

Returns: Promise<any> Returns a Promise


createEventInteractivelyWithOptions

createEventInteractivelyWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>

Interactively create an event with additional options.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional options CalendarOptions

Returns: Promise<any>


createEventWithOptions

createEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>

Silently create an event with additional options.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional options CalendarOptions

Returns: Promise<any> Returns a Promise


deleteCalendar

deleteCalendar(name: string): Promise<any>

Delete a calendar. (iOS only)

Parameters:

Name Type Description
name string Name of the calendar to delete.

Returns: Promise<any> Returns a Promise


deleteEvent

deleteEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>

Delete an event.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date

Returns: Promise<any> Returns a Promise


deleteEventById

deleteEventById(id: string, fromDate?: Date): Promise<any>

Delete an event by id.

Parameters:

Name Type
id string
Optional fromDate Date

Returns: Promise<any> Returns a Promise


deleteEventFromNamedCalendar

deleteEventFromNamedCalendar(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, calendarName?: string): Promise<any>

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

Parameters:

Name Type Description
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional calendarName string -

Returns: Promise<any> Returns a Promise


findAllEventsInNamedCalendar

findAllEventsInNamedCalendar(calendarName: string): Promise<any>

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

Parameters:

Name Type
calendarName string

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


findEvent

findEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise<any>

Find an event.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date

Returns: Promise<any>


findEventWithOptions

findEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise<any>

Find an event with additional options.

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional options CalendarOptions

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


getCalendarOptions

getCalendarOptions(): CalendarOptions

Returns the default calendar options.

Returns: CalendarOptions Returns an object with the default calendar options


getCreateCalendarOptions

getCreateCalendarOptions(): NameOrOptions

Returns options for a custom calender with specific color

Returns: NameOrOptions Returns an object with the default options


hasReadPermission

hasReadPermission(): Promise<boolean>

Check if we have read permission

Returns: Promise<boolean>


hasReadWritePermission

hasReadWritePermission(): Promise<boolean>

This function checks if we have permission to read/write from/to the calendar. The promise will resolve with true when:

  • You're running on iOS, or
  • You're targeting API level lower than 23, or
  • You're using Android < 6, or
  • You've already granted permission

If this returns false, you should call the requestReadWritePermission function

Returns: Promise<boolean>


hasWritePermission

hasWritePermission(): Promise<boolean>

Check if we have write permission

Returns: Promise<boolean>


listCalendars

listCalendars(): Promise<any>

Get a list of all calendars.

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


listEventsInRange

listEventsInRange(startDate: Date, endDate: Date): Promise<any>

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

Parameters:

Name Type
startDate Date
endDate Date

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


modifyEvent

modifyEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date): Promise<any>

Modify an event. (iOS only)

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional newTitle string
Optional newLocation string
Optional newNotes string
Optional newStartDate Date
Optional newEndDate Date

Returns: Promise<any> Returns a Promise


modifyEventWithOptions

modifyEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date, filterOptions?: CalendarOptions, newOptions?: CalendarOptions): Promise<any>

Modify an event with additional options. (iOS only)

Parameters:

Name Type
Optional title string
Optional location string
Optional notes string
Optional startDate Date
Optional endDate Date
Optional newTitle string
Optional newLocation string
Optional newNotes string
Optional newStartDate Date
Optional newEndDate Date
Optional filterOptions CalendarOptions
Optional newOptions CalendarOptions

Returns: Promise<any> Returns a Promise


openCalendar

openCalendar(date: Date): Promise<any>

Open the calendar at the specified date.

Parameters:

Name Type Description
date Date The date you want to open the calendar on

Returns: Promise<any> Promise returns a promise


requestReadPermission

requestReadPermission(): Promise<any>

Request read permission

Returns: Promise<any>


requestReadWritePermission

requestReadWritePermission(): Promise<any>

Requests read/write permissions

Returns: Promise<any>


requestWritePermission

requestWritePermission(): Promise<any>

Request write permission

Returns: Promise<any>



Interfaces

CalendarOptions

CalendarOptions:

<Optional> calendarId

● calendarId: number

Calendar id


<Optional> calendarName

● calendarName: string

Calendar name. Ths is supported by iOS only.


<Optional> firstReminderMinutes

● firstReminderMinutes: number


<Optional> id

● id: string

Id


<Optional> recurrence

● recurrence: string

Recurrence. Can be set to daily, weekly, monthly or yearly


<Optional> recurrenceEndDate

● recurrenceEndDate: Date

Recurrence end date. Valid only when recurrence option is set.


<Optional> recurrenceInterval

● recurrenceInterval: number

Recurrence interval. Valid only when recurrence option is set.


<Optional> secondReminderMinutes

● secondReminderMinutes: number


<Optional> url

● url: string

URL



NameOrOptions

NameOrOptions:

<Optional> calendarColor

● calendarColor: string

Calendar color as a HEX string


<Optional> calendarName

● calendarName: string

Calendar name



Other Versions