Event
Calendar event creation and fetching
A calendar event. Use the constructor to make one, Event.fetch() to query existing ones, and save()/remove() on what you get back.
Properties
identifierStringEvent identifier
titleStringEvent title
locationStringEvent location
notesStringEvent notes
startDateDateTime ›Event start date
endDateDateTime ›Event end date
isAllDayBooleanWhether this is an all-day event
availabilityStringEvent availability
timeZoneStringEvent time zone
calendarCalendar ›Calendar this event belongs to
attendees[Attendee] ›Event attendees
Methods
.save()Event ›Save this event.
.remove()Delete this event.
.clearRecurrences()Remove all recurrence rules from this event.
.presentEdit()Event ›Present the system event editor.
Event(config?)Event ›Creates an event. Call save() on it to write it to the calendar.
- config Any
- title String required
What it is called.
- startDate DateTime required
When it starts.
- endDate DateTime
When it ends.
- isAllDay Boolean
An all-day event ignores the times.
- location String
Where it is.
- notes String
Free text.
- calendar Any
Which calendar to write to. The default one when left out.
- availability String
busy, free, tentative or unavailable.
- title String required
Event.fetch(query?, calendars?)[Event] ›Events matching a query.
Event.presentCreate()Event ›Present the system event creation dialog.
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();