Calendar
Event calendar access and manipulation
The user's calendars. Fetch, create, edit and delete events, including recurrence rules. Needs calendar access.
Properties
identifierStringCalendar identifier
titleStringCalendar title
isSubscribedBooleanWhether this is a subscribed calendar
allowsContentModificationsBooleanWhether this calendar allows modifications
colorColor ›Calendar color
Methods
.supportsAvailability(availability)BooleanCheck if this calendar supports a given availability type.
- availability String required
.save()Save changes to this calendar.
.remove()Delete this calendar.
Calendar.fetch(options?)Calendar ›Fetch calendars.
- options Any
Left out entirely, every calendar comes back.
- default Boolean
The calendar new events go into.
- title String
Match by name.
- identifier String
Match by identifier.
- default Boolean
returns Every calendar with no options, one calendar when matching, null when nothing matches.
Calendar.presentPicker(allowMultiple?)[Calendar] ›Present the system calendar picker.
- allowMultiple Boolean
Examples
Fetch today's events
const events = Event.fetch({
timeframe: "today"
});
for (const e of events) {
console.log(e.title, e.startDate.format("HH:mm"));
}Create recurring event
const event = new Event({
title: "Standup",
startDate: DateTime.from({hour: 9, minute: 30}),
endDate: DateTime.from({hour: 9, minute: 45})
});
event.setRecurrence({
frequency: "weekly", interval: 1
});
event.save();