API Docs

An event from a calendar, as returned by hs.eventkit.events() and its relatives.

Each property is read from the underlying calendar event when you access it, so fetching many events is cheap even when you only look at a few of their properties. An event is a snapshot: if it changes in Calendar after you fetched it, fetch it again to see the change.

Don't create these yourself; they come from hs.eventkit.

  • Example:
hs.eventkit.eventsToday().forEach(e => {
    console.log(e.startDate.toLocaleTimeString() + " " + e.title + (e.location ? " @ " + e.location : ""))
})

Properties

id

string

The event's identifier on this Mac.

Every occurrence of a repeating event has the same id, so use it together with occurrenceDate (or startDate) to tell occurrences apart.

externalID

string

The identifier the calendar server gives the event, which is the same on every device but isn't guaranteed to be unique.

location

string

The event's location, which often holds a Zoom or Teams link.

notes

string

The event's notes (its description), which often hold a meeting link.

url

string

The URL attached to the event.

occurrenceDate

Date

The original start of this occurrence of a repeating event, which stays the same if the occurrence is moved.

isAllDay

boolean

Whether this is an all-day event.

timeZone

string

The event's time zone (e.g. "Europe/London"), or null for a floating event that follows the Mac's time zone.

isActive

boolean

Whether the event is happening now: from its start up to (but not including) its end, or for an all-day event, at any time on the days it covers.

This is worked out each time you read it, so a long-lived event object stays accurate.

isDetached

boolean

Whether this occurrence of a repeating event has been changed from the rest.

status

string

The event's status: "none", "confirmed", "tentative" or "canceled".

availability

string

How the event shows on a schedule: "busy", "free", "tentative", "unavailable", or "notSupported" when its calendar doesn't support availability.

calendarID

string

The identifier of the event's calendar, as in hs.eventkit.calendars().

Methods

toJSON() -> object

Returns a plain object holding all of the event's properties, for JSON serialisation.

JSON.stringify() calls this automatically, so you rarely need to call it yourself.

toJSON() -> object
object
An object with every property of the event, with the values of its properties of the same names
Field Type Description
id string
externalID string | null
title string
location string | null
notes string | null
url string | null
startDate Date
endDate Date
occurrenceDate Date | null
isAllDay boolean
timeZone string | null
isActive boolean
isRecurring boolean
isDetached boolean
status "none" | "confirmed" | "tentative" | "canceled"
availability "busy" | "free" | "tentative" | "unavailable" | "notSupported"
calendarID string | null
calendarTitle string | null
console.log(JSON.stringify(hs.eventkit.eventsToday(), null, 2))