V4 Release Notes and Upgrade Guide
Initialization
Previously, a calendar was initialized by calling the $().fullCalendar()
jQuery method. FullCalendar resided in a single JavaScript file that needed to be included on the page before pageload.
Now, a calendar is initialized by instantiating a Calendar
object and then calling its render
method. Also, all functionality has been broken into plugins. You’ll need to use the plugin system for any and all views in addition to drag-n-drop functionality. See a full list of plugins »
If you want to use script tags and browser globals you can do something like this:
<link href='fullcalendar/core/main.css' rel='stylesheet' />
<link href='fullcalendar/daygrid/main.css' rel='stylesheet' />
<script src='fullcalendar/core/main.js'></script>
<script src='fullcalendar/daygrid/main.js'></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid' ],
defaultView: 'dayGridMonth'
});
calendar.render();
});
</script>
Or if you want to use an ES6 build environment install the necessary dependencies:
npm install --save @fullcalendar/core @fullcalendar/daygrid
And then write your JS:
import { Calendar } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new Calendar(calendarEl, {
plugins: [ dayGridPlugin ],
defaultView: 'dayGridMonth'
});
calendar.render();
});
You’ll need to manually include the necessary CSS files on your page like so:
<link href='node_modules/@fullcalendar/core/main.css' rel='stylesheet' />
<link href='node_modules/@fullcalendar/daygrid/main.css' rel='stylesheet' />
Also, many of the views have been renamed:
monthrenamed to dayGridMonth (requires the daygrid plugin, but has its own article)basicWeekrenamed to dayGridWeek (requires the daygrid plugin)basicDayrenamed to dayGridDay (requires the daygrid plugin)agendaWeekrenamed to timeGridWeek (requires the timegrid plugin)agendaDayrenamed to timeGridDay (requires the timegrid plugin)
Scheduler
The premium Scheduler product has been broken into a number of separate plugins. Also, the names and meanings of each view have changed.
Previously, to display a resource view, you would specify the resources
option, and if working with vertical resource view, you might specify groupByResource
or groupByDateAndResource
as well. In v4, things are much more explicit. To display a resource view, you must choose one of the following views:
- resourceTimeGridWeek - use instead of
agendaWeekfor resources (requires the resource-timegrid plugin) - resourceTimeGridDay - use instead of
agendaDayfor resources (requires the resource-timegrid plugin) - resourceDayGridWeek - use instead of
basicWeekfor resources (requires the resource-daygrid plugin) - resourceDayGridDay - use instead of
basicDayfor resources (requires the resource-daygrid plugin) - resourceTimelineYear - use instead of timelineYear for resources (requires the resource-timeline plugin)
- resourceTimelineMonth - use instead of timelineMonth for resources (requires the resource-timeline plugin)
- resourceTimelineWeek - use instead of timelineWeek for resources (requires the resource-timeline plugin)
- resourceTimelineDay - use instead of timelineDay for resources (requires the resource-timeline plugin)
The following views previouly might have displayed resources, but in v4, they are guaranteed to NOT display resources:
- timelineYear - will NOT display resources (requires the timeline plugin)
- timelineMonth - will NOT display resources (requires the timeline plugin)
- timelineWeek - will NOT display resources (requires the timeline plugin)
- timelineDay - will NOT display resources (requires the timeline plugin)
Core Changes
print stylesheet |
No need to use a separate |
---|---|
calling methods |
Instead of using jQuery like
|
util functions |
Top-level utility functions that were called like |
handlers |
The
|
dynamic handlers |
The |
dynamic options |
Instead of using jQuery to get options like
And instead of using jQuery to set options like
|
To get the current View Object, access the Calendar’s |
|
render method |
When called after initialization, will rerender everything, not just merely adjust the calendar’s size. For that, use updateSize. Issue 2709 |
loading method |
No longer receives a view as its second parameter. |
New things:
updateSize |
Will readjust a calendar’s sizing (what the |
---|---|
batchRendering |
Will group operations and consolidate them into a single rerender. Solves issue 3262 |
rerenderDelay |
The amount of milliseconds to wait before rerendering anything on a calendar. |
Date Library
Breaking changes:
Moment JS removal |
Moment JS has been removed as a dependency and thus there is no need to include |
---|---|
Ambiguously-timed Moments |
Will now be |
date formatting strings |
Instead of specifying date formats as command strings like Also, you can use functions to programmatically generate date string text. Issue 3664 You can still use command strings, but you’ll need to use the moment or luxon plugins. |
formatRange method |
Signature has been changed from |
duration objects |
Instead of Moment Duration objects, these objects are plain objects in the form You can use the moment or luxon plugins to convert them to something more powerful. |
weekNumberCalculation |
When specifying a function, the function will receive a single Date object, not a Moment. |
New things:
defaultRangeSeparator |
Determines the separator text used for date-formatting ranges throughout the API, except for the toolbar title text, which is affected by titleRangeSeparator. |
---|---|
formatDate util func |
Formats a date into a string. |
formatDate method |
Formats a date into a string. Inherits the locale and time zone settings of the calendar it’s called on. |
formatIso method |
Formats a date into an ISO8601 string. Outputs a UTC offset appropriate to the calendar it’s called on. |
formatRange method |
Formats two dates, a start and an end, into a string. Inherits settings from the calendar it’s called on. |
Time Zone
Renamed to timeZone (to be more consistent with native naming conventions) |
|
Date objects |
The current timeZone will affect how you will interpret the Date objects emitted from the API. Whether you will use local methods like |
Ambiguously-zoned Moments |
Will now be |
the default time zone |
The default timezone is now |
a false time zone |
The |
Plugins |
Browsers have a tough time supporting time zones other than local and UTC, which is why the default named time zone implementation essentially shoehorns everything into UTC Date objects. However you can use third-party adapter plugins like moment-timezone or luxon for more authentic time zone implementations, though browser support will vary. Issue 3188 |
Locales
Breaking changes:
paths to locale files |
|
---|---|
Use the dir settings instead.
|
|
Removed. Use a date-formatting plugin or function instead. |
|
Removed. Use a date-formatting plugin or function instead. |
|
Removed. Use a date-formatting plugin or function instead. |
|
Removed. Use a date-formatting plugin or function instead. |
|
jQuery UI Datepicker |
Previously, FullCalendar was kind enough to populate locales for jQuery UI Datepicker. This is no longer the case. |
Enhancements:
If you need a locale that does not have a matching locales/*.js
file you may still set the locale
setting. You will get partial support: most date-related strings within the calendar will correctly translate, but those in the buttons of the header/footer will not.
Event Model
Previously, event objects would be specified as plain objects, and then when accessing those same events in other parts of the API, they would be slightly-massaged versions of the same plain objects. Now, you still specify plain objects (though some properties have changed), but when you retrieve them in other parts of the API, they are instances of the Event class with methods for manipulation.
The plain-object’s input properties have changed a bit:
|
|
id |
Was previously used to group related events together, so that they could be dragged/resized together. That is now done with |
recurring props (start/end/dow) |
These props were never officially supported. Use |
The outputted object, which is now an instance if the Event
class, has properties that differ from the previously-available massaged plain-object:
|
|
groupId |
All events with the same groupId will be dragged, resized, and mutated together. Issue 4147 |
start |
A Date object. No longer a moment. |
end |
A Date object. No longer a moment. |
Access |
|
extendedProps |
Previously, any non-standard properties would be preserved as top-level keys. Now, they are moved into the It is also possible to specify an explicit |
Removed. Use getResources instead, like |
|
Removed. Use getResources instead, like |
Various methods of the Calendar
object that manipulate events have been converted to Event
methods:
Removed. For retrieving a single event, use getEventById. For retrieving all events, use getEvents. For retrieving a subset of events, filter the returned array:
|
|
Removed. Instead, retrieve an Event object and then call a method that performs manipulation:
Manipulation methods: setProp, setExtendedProp, setStart, setEnd, setDates, setAllDay, moveStart, moveEnd, moveDates |
|
Removed. Instead, retrieve an Event object and then call its remove method:
|
|
Removed. Instead, use multiple Event::remove calls. Group together for performance with batchRendering. |
The following settings have changed:
defaultTimedEventDuration |
The default has changed from 2 hours to 1 hour. |
---|
Also, recurring events is now a built-in feature! You can use simple event recurrence or use the RRule adapater. Issue 387
Event Source
Just as before, event sources can be specified in their “extended form”, a plain object with properties. The format for this plain object has changed slightly:
overlap |
Can longer specify a function. Use the calendar-wide eventOverlap instead. |
---|---|
allow (new) |
Like the calendar-wide eventAllow but for this event source only. |
success (new) |
A function that gets called when fetching succeeds. Will receive two arguments, the raw event array and an XHR if applicable. Can massage the response by returning an event source array to use instead. |
failure (new) |
A function that gets called when fetching failed. Probably because an AJAX request failed. Receives one argument, an error object. |
eventDataTransform |
Can now return |
This plain object is then parsed and becomes available in places like getEventSourceById and the event object’s source
property. Previously, these event source references would be slighly massaged version of the original plain object. Now, they are instances of the EventSource
class and have methods that allow manipulation.
In v4, this new EventSource
object is rather limited, offering only two properties: id
and url
. More info
Also, the EventSource
object offers methods that replace the following Calendar
methods:
Removed. Instead, retreive an Event Source object and then calls its refetch method:
|
|
Removed. Instead, retreive an Event Source object and then calls its remove method:
|
|
Removed. Instead, use multiple EventSource::remove calls. Group together for performance with batchRendering. |
There are two new calendar-wide callbacks:
eventSourceSuccess |
A function that gets called when fetching succeeds. Will receive two arguments, the raw event array and an XHR if applicable. Can massage the response by returning an event source array to use instead. Issue 2431 |
---|---|
eventSourceFailure |
A function that gets called when fetching failed. Probably because an AJAX request failed. Receives one argument, an error object. |
Event Source Function
An event-fetching function previously accepted the following arguments:
function( startMoment, endMoment, timeZoneStr, callback )
Now, it accepts the following arguments:
function( fetchInfo, successCallback, failureCallback )
It must call successCallback
, failureCallback
, or return a Promise. fetchInfo
is an object that has a bunch of other properties. See the full article. A stubbed example of how to use the new signature:
var calendar = new Calendar(calendarEl, {
events: function(fetchInfo, successCallback, failureCallback) {
console.log(fetchInfo.startStr); // '2018-08-26T00:00:00-05:00'
console.log(fetchInfo.endStr); // '2018-10-07T00:00:00-05:00'
console.log(fetchInfo.timeZone); // 'local'
successCallback([]);
}
})
Solves issue 3593
Event JSON Feed
The following FullCalendar functionality has been affected:
JSONP requesting |
It is no longer possible to request events via JSONP. CORS will be used instead. Make sure your server is set up to do CORS. |
---|---|
jQuery.ajax settings |
The full range of jQuery.ajax settings are no longer accepted. However, can use the following new settings:
|
cachebusting |
The
|
The following request parameters have been affected:
startParam |
Would previously generate strings like |
---|---|
endParam |
Same comments as |
Renamed to timeZoneParam. Defaults to If your server-side scripts previously relied on a |
Google Calendar Event Source
The Google Calendar Event Source has been affected:
Removed. Use eventSourceFailure instead. Issue 3982 |
|
timeZone |
Previously, it was possible to specify timeZones with spaces such as “America/New York”. Now, you must use underscores like “America/New_York”. |
View API
The way Views are customized and defined has been affected:
view-specific options |
In parity with how view names have been renamed, instead of specifying |
---|---|
custom views written in JS |
When subclassing the |
registering a custom view |
Previously, to globally define a new type of view, you would use this technique:
This must rewritten as a plugin:
Solves issue 3657. |
The View object’s properties have changed a bit:
Renamed to |
|
|
Renamed to |
|
Renamed to |
View Rendering
The following view-rendering-related callbacks have been affected:
Renamed to datesRender. Parameters have changed. |
|
Renamed to datesDestroy. Parameters have changed. |
|
viewSkeletonRender (new) |
Triggered after a view’s non-date-related DOM structure has been rendered. |
viewSkeletonDestroy (new) |
Triggered before a view’s DOM skeleton is removed from the DOM. |
Date Rendering
The following settings have been affected:
columnHeaderFormat |
No longer accepts a format-string out of the box. Use a date-formatting object instead. |
---|---|
This deprecated alias of columnHeaderFormat has been removed. Use columnHeaderFormat instead. |
|
slotLabelFormat |
No longer accepts a format-string out of the box. Use a date-formatting object instead. |
columnHeaderText |
Accepts a normal Date object now. |
dayRender |
Instead of receiving
|
Date Navigation
The getDate method will return a Date object not a Moment.
Date Clicking & Selecting
The interaction plugin is now required to detect date clicking and selecting:
import { Calendar } from '@fullcalendar/core';
import interactionPlugin from '@fullcalendar/interaction';
let calendar = new Calendar(calendarEl, {
plugins: [ interactionPlugin ],
selectable: true,
select: function(info) { },
dateClick: function(info) { }
});
Other breaking changes:
Renamed to dateClick. Instead of ordered arguments, receives on object argument. Stub example:
Also, this is now triggered when the user clicks on top of a background event. Issue 2843 |
|
select callback |
Instead of ordered arguments, receives on object argument. Stub example:
|
select method |
Removed the ordered argument signature: |
Renamed to selectMirror. |
|
selectConstraint |
A string that represents an event ID is no longer accepted. Instead, a string represents an event group ID. The simplest migration tactic is to assign |
Also, a bug related to an unwanted unselect on touch devices has been fixed. Issue 4062
Event Rendering
The following settings have been affected:
nextDayThreshold |
Default has been changed to Also, a bug with events that begin before the view’s start date has been fixed. Issue 3943 |
---|---|
eventOrder |
This value how has complete control over ordering events within a day, as opposed to before when events were always ordered by time first. The default is now If your old value for this setting was something like |
eventRender |
Instead of accepting
Addresses issue 3674, 3956, 2616, 3952, and 3311 |
eventDestroy |
Instead of accepting
|
Renamed to eventTimeFormat. Accepts a date-formatting object instead. Issue 1019 |
|
Renamed to eventPositioned. Instead of accepting |
|
Removed. The concecpt of event rendering being fully complete is flawed (such as when events are revealed in a +more popup). You should operate on individual events instead, via eventPositioned or use some other callback. |
|
Removed. Use rerenderDelay instead, which waits before rerendering anything. |
|
progressiveEventRendering (new) |
When to render multiple asynchronous event sources in an individual or batched manner. Issue 1672 and 4072 |
The following Calendar
methods have been affected:
Renamed to addEvent. The |
|
Removed. Use multiple addEvent calls instead. Group together for performance with batchRendering. |
Visual changes:
In a timeGrid
view (previously called “agenda view”, when an event is all-day, it would previously only render in the all-day area at the top. Now, it will render in both the all-day area and the time slots. See this illustration.
Event Clicking & Hovering
The following callbacks have been affected:
eventClick |
Where previously received ordered arguments You can no longer return
|
---|---|
Renamed to eventMouseEnter. Where previously received ordered arguments |
|
Renamed to eventMouseLeave. Where previously received ordered arguments |
Event Dragging & Resizing
The interaction plugin is now required to do event drag-n-drop and resizing:
import { Calendar } from '@fullcalendar/core';
import interactionPlugin from '@fullcalendar/interaction';
let calendar = new Calendar(calendarEl, {
plugins: [ interactionPlugin ],
editable: true
});
Other breaking changes:
eventDragStart |
Where previously received ordered arguments |
---|---|
eventDragStop |
Where previously received ordered arguments |
eventDrop |
Previously accepted ordered arguments
The |
eventResizeStart |
Where previously received ordered arguments |
eventResizeStop |
Where previously received ordered arguments |
eventResize |
Previously accepted ordered arguments
The |
eventResizableFromStart (new) |
Whether the event can be resized from its starting edge. Defaults to |
eventDragMinDistance (new) |
How many pixels the user’s mouse/touch must move before an event drag or resize activates. |
allDayMaintainDuration (new) |
Determines how an event’s duration should be mutated when it is dragged from a timed section to an all-day section and vice versa. Issue 2764 |
dragScroll |
Does auto-scrolling not just for event dragging, but also for event resizing, external element dragging, and date selecting. Issue 242 |
Removed. Use the following CSS instead:
You can tweak this CSS to get different opacity values for different scenarios. |
|
eventConstraint EventSource::constraint Event::constraint |
Can no longer specify a single string event ID, but rather a single string The recurring properties Can accept an array of objects. Useful if you want to specify multiple date ranges. |
Dragging External Elements & Events
Version 4 offers the following new features:
no third-party dependencies |
You no longer need jQuery UI to be able to drag elements into a calendar. You can use the built-in |
---|---|
plugins |
If you’d like to use a third-party library for dragging such as Dragula, you can use the |
dragging between calendars |
It’s possible to drag events between two separate Calendar instances. More information. Issue 820 |
The following existing functionality has been affected:
data-event-* attributes |
When associating event data with an element, you can no longer specify properties as separate HTML attributes. Instead, bundle them all together under one JSON string in the |
---|---|
data-event="1" attribute |
You would previously specify a |
External events that are dropped on all-day areas can be given a default time. This was previously done with the |
|
event creation and eventReceive callback |
Event creation upon drop and firing of the eventReceive callback will happen by default. To prevent this from happening, specify The eventReceive callback previously received a single Event object argument. It now receives an object |
drop callback |
Instead of ordered arguments If dropped on an all-day slot, the |
Week Numbers
Renamed to weekLabel. Will now affect week text in date formatting. |
Event Popover
The following settings related to the event popover have been affected:
dayPopoverFormat |
Does not accept date-formatting string by default. Use a date-formatting object. |
---|---|
navLinkDayClick |
When specifying a function, accepts a Date object not a Moment. |
Business Hours
When specifying business hours, the recurring properties dow
/ start
/ end
have been renamed to daysOfWeek
/ startTime
/ endTime
.
Toolbar
The following settings related to toolbars (aka, the header and footer) have been affected:
titleFormat |
Does not accept date-formatting string by default. Use a date-formatting object. |
---|---|
titleRangeSeparator (new) |
Determines the separator text when formatting the date range in the toolbar title. Default to an elongated dash. |
Theming
This previously-deprecated setting has been removed. Use themeSystem instead. |
|
themeSystem set to 'bootstrap4' |
Now, simply specify |
Bootstrap 3 support |
Removed. Consequently, the |
jQuery UI theme support |
Removed. Consequently, the |
Month View
The MonthView
class is no longer exposed. Internally, the functionality has been rolled into DayGridView
, which is exposed.
Agenda View
As mentioned above, the “agenda views” have been renamed to the timeGrid
views. The following settings have been affected:
Renamed to timeGridEventMinHeight |
|
Renamed to |
List View
The following settings related to List View have been affected:
listDayFormat |
Does not accept date-formatting string by default. Use a date-formatting object. |
---|---|
listDayAltFormat |
Does not accept date-formatting string by default. Use a date-formatting object. |
Timeline View
Breaking changes:
resourceColumns |
The |
---|---|
User-resizable columns and resource-area |
The user is able to resize the resourceAreaWidth as well as the columns created by resourceColumns. Previously it “just worked,” but now you’ll need to load the interaction plugin. |
Vertical Resource View
Previously, the groupByResource and groupByDateAndResource settings would do two things. They would “activate” a vertical resource view (as opposed to rendering the non-resource version of the view) as well as control the headers at the top of the view.
Now, explicitly specifying a resource view such as resourceTimeGridDay
is how you “activate” a vertical resource. Additionally, these two settings have been collapsed into one:
datesAboveResources: false // the default. instead of groupByResource:true
datesAboveResources: true // instead of groupByDateAndResource:true
Resource Fetching
A resource-fetching function previously accepted the following arguments:
function( callback, startMoment, endMoment, timeZone )
Now, it acceps the following arguments:
function( fetchInfo, successCallback, failureCallback )
It must call successCallback
, failureCallback
, or return a Promise. fetchInfo
is an object that contains the date-related properties. See the full article.
Other resource-fetching changes:
The following Calendar
triggers have been affected:
Removed. Was never officially supported. |
Resource Model
Previously, resource objects would be specified as plain objects, and then when accessing those same events in other parts of the API, they would be slightly-massaged versions of the same plain objects. Now, you still specify plain objects, but when you retrieve them in other parts of the API, they are instances of the Resource class with methods for manipulation.
The following properties are now accepted in the raw object:
eventOverlap | The eventOverlap setting for associated events. Does not accept a function. |
---|---|
eventConstraint | The eventConstraint setting for associated events. |
eventAllow | The eventAllow setting for associated events. |
The plain object will eventually be parsed into a proper Resource object, which has a number of differences from v3:
Removed. Use getParent instead. |
|
Removed. Use getChildren instead. |
|
extendedProps |
Where all non-standard properties are stored. Previously, non-standard properties would be stored in the top-level object. |
The following resource-related methods/properties in the Calendar
object have been affected:
Removed. Use eventDataTransform instead. |
|
addResource |
The |
getResources |
Now retrieves all resources, including nested child resources, in one flat array. |
getTopLevelResources (new) |
Retrieves only top-level resource (resources that don’t have a specified parent). |
Removed. Use the |
|
Removed. Use the |
Resource Rendering
resourceRender trigger |
Used to accept ordered arguments There is currently no way to retrieve the element(s) that were previously available in |
---|---|
rerenderResources method |
Previously rerendered all resources AND events. Now only renders the areas of the view where explicit resource data is displayed, such as the left cells in Timeline View and the top header in Vertical Resource View. |
Versioning Scheme
Previously, the Core package was at version 3.x.x
and the Scheduler package was at 1.x.x
. There was no rhyme or reason as to which versions were compatible.
Now, all of v4’s plugins will be at 4.x.x
including Scheduler functionality. All plugins with the same minor version (like 4.1.x
) are implied to be compatible.
Package Managers
Support for NPM (and Yarn) is strong, but here’s what happened to support for other package managers:
Bower |
Support has been dropped. |
---|---|
Composer |
Support has been dropped. More info. |