Options
All
  • Public
  • Public/Protected
  • All
Menu

Calendar

Calendar objects are used to manipulate and create calendars in the built-in Calendars app and its associated accounts.

Example: Event Creation

var calendar = Calendar.findOrCreate("Activities");
var event = calendar.createEvent();
event.title = "Dinner Party";
event.notes = "Bring side dish.";
event.startDate = Date.parse("7pm next friday");
event.endDate = Date.parse("10pm next friday");
event.isAllDay = false;
if (!event.update()) {
  console.log(event.lastError);
}

Example: Reading Calendar Events

// load a calendar
let cal = Calendar.find("Test");
// loop over events in the last 30 days and alert the name of each.
if (cal) {
    let events = cal.events((30).days().ago(), new Date());
    for (let event of events) {
        alert(event.title);
    }
}

Hierarchy

  • Calendar

Index

Properties

allowsContentModificationx

allowsContentModificationx: boolean

A Boolean value that indicates whether you can add, edit, and delete items in the calendar.

isImmutable

isImmutable: boolean

A Boolean value indicating whether the calendar’s properties can be edited or deleted.

title

title: string

Methods

createEvent

events

  • events(startDate: Date, endDate: Date): Event[]
  • Returns array of events on the calendar between the start and end dates specified.

    Parameters

    • startDate: Date
    • endDate: Date

    Returns Event[]

update

  • update(): boolean

Static default

Static find

  • find(title: string): Calendar | undefined
  • Searches for a calendar matching the title. If none is found, return undefined.

    Parameters

    • title: string

    Returns Calendar | undefined

Static findOrCreate

  • Searches for a calendar matching the title. If none is found, creates a new list with that title in your default calendars account. If more than one calendar with the same name exist in Calendars, the first found will be returned.

    Parameters

    • title: string

    Returns Calendar

Static getAllCalendars

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc