HSReminder
TypeA reminder from the Reminders app, as returned by hs.eventkit.incompleteReminders() and its
relatives.
Each property is read from the underlying reminder when you access it. A reminder is a snapshot: if it changes in Reminders after you fetched it, fetch it again to see the change.
The properties are read-only; change a reminder with update(), which saves the change straight
away, and delete it with remove().
Don't create these yourself; they come from hs.eventkit, and hs.eventkit.createReminder()
makes new ones.
- Example:
hs.eventkit.incompleteReminders().then(reminders => {
reminders.filter(r => r.dueDate && r.dueDate < new Date())
.forEach(r => console.log("Overdue: " + r.title))
})
Properties
externalID
The identifier the server gives the reminder, which is the same on every device but isn't guaranteed to be unique.
dueDate
When the reminder is due, or null if it has no due date. For a reminder that is due on a
day rather than at a time (see isAllDay), this is the start of that day.
isAllDay
Whether the reminder is due on a day, rather than at a particular time. Always false for a
reminder with no due date.
alarmDates
When the reminder's alerts go off. Only alerts at a set time are listed; Reminders can also
have alerts for arriving at or leaving a place, which update() leaves alone.
A due date doesn't produce a notification by itself: add an alert for that.
Methods
update(changes) -> HSReminder
Changes some of the reminder's properties and saves the change.
The properties changes leaves out are left as they are.
If anything in changes is invalid, or the change can't be saved, this throws and the
reminder is left as it was.
update(changes) -> HSReminder
| Name | Type | Description |
|---|---|---|
| changes | HSReminderChanges | The properties to change |
try {
reminder.update({ isCompleted: true })
reminder.update({ dueDate: new Date(Date.now() + 3600000), priority: "high" })
} catch (err) {
console.error(err.message)
}
remove() -> boolean
Deletes the reminder.
The object keeps its properties afterwards, but it can't be updated or saved again.
remove() -> boolean
try {
reminder.remove()
} catch (err) {
console.error(err.message)
}
toJSON() -> object
Returns a plain object holding all of the reminder's properties, for JSON serialisation.
JSON.stringify() calls this automatically, so you rarely need to call it yourself.
toJSON() -> object
| Field | Type | Description |
|---|---|---|
| id | string | |
| externalID | string | null | |
| title | string | |
| notes | string | null | |
| url | string | null | |
| dueDate | Date | null | |
| isAllDay | boolean | |
| priority | "none" | "low" | "medium" | "high" | |
| isCompleted | boolean | |
| completionDate | Date | null | |
| alarmDates | Date[] | |
| isRecurring | boolean | |
| listID | string | null | |
| listTitle | string | null | |
| creationDate | Date | null | |
| lastModifiedDate | Date | null |
hs.eventkit.incompleteReminders().then(r => console.log(JSON.stringify(r, null, 2)))