Event Object
A JavaScript object that FullCalendar uses to store information about a calendar event. It is exposed in various places of the API such as getEventById and provides methods for dynamic manipulation. It was originally parsed from a plain object.
var calendar = new Calendar(calendarEl, {
timeZone: 'UTC',
events: [
{
id: 'a',
title: 'my event',
start: '2018-09-01'
}
]
})
var event = calendar.getEventById('a') // an event object!
var start = event.start // a property (a Date object)
console.log(start.toISOString()) // "2018-09-01T00:00:00.000Z"
An event object has a number of properties and methods. All properties are read-only and you must use the methods to modify the properties. Here is a list of all properties that exist on an event object:
id |
String. A unique identifier of an event. Useful for getEventById. |
---|---|
groupId |
String. Events that share a |
allDay |
Boolean ( |
start |
Date object that obeys the current timeZone. When an event begins. |
end |
Date object that obeys the current timeZone. When an event ends. It could be Note: This value is exclusive. For example, an event with the |
title |
String. The text that will appear on an event. |
url |
String. A URL that will be visited when this event is clicked by the user. For more information on controlling this behavior, see the eventClick callback. |
classNames |
An array of strings like |
editable |
Boolean ( |
startEditable |
Boolean ( |
durationEditable |
Boolean ( |
resourceEditable |
Boolean ( |
rendering |
The rendering type of this event. Can be empty (normal rendering), |
overlap |
The value overriding the eventOverlap setting for this specific event. If |
constraint |
The eventConstraint override for this specific event. |
backgroundColor |
The eventBackgroundColor override for this specific event. |
borderColor |
The eventBorderColor override for this specific event. |
textColor |
The eventTextColor override for this specific event. |
extendedProps |
A plain object holding miscellaneous other properties specified during parsing. Receives properties in the explicitly given |
source |
A reference to the Event Source this event came from. If the event was added dynamically via addEvent, and the |
All properties are read-only. If you want to modify them, use the various methods of the Event object, such as setProp, setExtendedProp, setDates, etc.
The expected values for allDay
, start
and end
have been discussed in detail on the subject of parsing events. It is vital to understand how the end
date is exclusive throughout the FullCalendar API.
Non-standard Fields
In addition to the fields above, you may also include your own non-standard fields in each Event object. FullCalendar will not modify or delete these fields. For example, developers often include a description
field for use in callbacks such as eventRender. Any non-standard properites are moved into the extendedProps
hash during event parsing.
var calendar = new Calendar(calendarEl, {
events: [
{
title: 'BCH237',
start: '2019-08-12T10:30:00',
end: '2019-08-12T11:30:00',
extendedProps: {
department: 'BioChemistry'
},
description: 'Lecture'
}
// more events ...
],
eventRender: function (info) {
console.log(info.event.extendedProps);
// {description: "Lecture", department: "BioChemistry"}
}
});