Event object
Properties
id
- The event's unique ID, which is also the element ID.
slug
- The event's unique URL slug.
title
- The event's title.
status
- The event's status.
enabled
- If the event is enabled.
authorId
- The event's author ID.
author
- The event's author.
startDate
- a Date object.
- Can be formatted with
.format("l, F j, Y \\a\\t g:ia")
- If you'd like to have dates translatable, use
startDateLocalized
instead andformat()
with|date()
filter, e.g.event.startDateLocalized|date("l, F j, Y g:ia")
.
endDate
- a Date object.
- Can be formatted with
.format("l, F j, Y \\a\\t g:ia")
- If you'd like to have dates translatable, use
endDateLocalized
instead andformat()
with|date()
filter, e.g.event.startDateLocalized|date("l, F j, Y g:ia")
.
duration
allDay
- a
boolean
value.
- a
multiDay
- a
boolean
value.
- a
repeating
- a
boolean
value.
- a
rrule
- The RFC RRule string used by ICS.
readableRepeatRule
- a human readable string of the
rrule
.
- a human readable string of the
simplifiedRepeatRule
- a simplified version of the repeat rule (e.g. Weekly).
isCurrentlyHappening
- Checks if the user's current time is between the event's start and end date.
- Based on the logged in user's locale, or otherwise the site's default timezone.
isHappeningOn
- Checks if the specified date and time is between the event's start and end date, e.g:
{% if event.isHappeningOn('2023-03-07 4:30pm') %} Yes! {% endif %}
- Time has a default of
00:00:00
, so if not specified, only All Day events will evaluate totrue
.
- Checks if the specified date and time is between the event's start and end date, e.g:
calendar
exceptions
- a list of exception models for recurring events.
- Exception models consist of these properties:
id
- the ID of the exceptioneventId
- the ID of the parent eventdate
- a\DateTime
object of the exception date
occurrences
- a list of Event objects of all occurrences for repeating rules.
occurrenceCount
- the total number of occurrence results.
url
- the URL of the event, if available, generated from Event URL path setting for calendars.
You can also access any custom fields which you have added to events by directly calling their handle (the handle must not match any of the existing event properties).
Usage in Templates
You can also access any custom fields which you have added to events by directly calling their handle (the handle must not match any of the existing event properties). If you had a field called Event Description with a handle of eventDescription you would access it in the template like this:
{{ event.eventDescription }}
You could make sure such a property exists first, to prevent errors in case the field is deleted:
{% if event.eventDescription is defined %}
{{ event.eventDescription }}
{% endif %}