Upgrading to v2

FullCalendar version 2.0 (full documentation) offers huge improvements in regards to timezones, internationalization, and date manipulation. Much of this is due to intergration with MomentJS, which is now a dependency. Because the changes are so dramatic, compatibility with the 1.x versions has been broken. This guide explains the differences between versions.

Options that now use Moments

Instead of native Date objects, Moment objects are now used throughout the API.

In addition, all end dates are now exclusive. For example, if an all-day event ends on a Thursday, the end date will be 00:00:00 on Friday. The 1.x versions had some strange rules in regards to this. Things should be much simpler now that exclusive end dates are used consistently throughout the API. In addition, this behavior is more consistent with other API’s and formats, such as iCalendar.

Affected options:

OptionUpgrade Notes
yearuse defaultDate instead, which is Moment-like and determines year, month, and date
month
date
gotoDate methodUses Moments
getDate method
events as a function
dayRender callback
dayClick callbackUses Moments, which may be ambiguously-timed.
allDay removed, delta added
drop callback
eventDrop callbackUses Moments, which may be ambiguously-timed.
allDay removed, delta added
eventResize callback
select callbackUses Moments, which may be ambiguously-timed.
allDay parameter removed. end is now exclusive!
select method

Event Object modifications:

PropertyUpgrade Notes
.startis now a Moment
.endis now a Moment, and is always exclusive!

View Objects modifications:

PropertyUpgrade Notes
.visStarthas become .start (a Moment)
.start repurposed!has become .intervalStart (a Moment)
.visEndhas become .end (an exclusive Moment)
.end repurposed!has become .intervalEnd (an exclusive Moment)

Note: anywhere in the API that accepts a Moment parameter, a “Moment-like” parameter (anything the Moment constructor accepts) can also be given. This includes raw ISO8601 strings like "2013-12-25".

Options that now use Durations

The MomentJS library provides a Duration object, which is also used throughout the API. It is used to specify intervals of time and anonymous times. The following options have been affected:

OptionUpgrade Notes
incrementDate methodaccepts a Duration
slotMinutessuperseded by slotDuration
snapMinutessuperseded by snapDuration
firstHoursuperseded by scrollTime
defaultEventMinutessuperseded by defaultTimedEventDuration
superseded by defaultAllDayEventDuration

Note: Anywhere the API accepts a Duration, a “Duration-like” parameter can be given (anything the Duration constructor accepts). This includes raw strings like "02:00" (two hours).

Date Formatting and Parsing

FullCalendar now leverges MomentJS for formatting dates into strings. Many of the formatting characters are the same, but some have changed!

Old CharactersNew Characters
yyyy (4 digit year)YYYY
yy (2 digit year)YY
dd (2 digit date of month)DD
d (1 digit date of month)D
tt (am or pm)a
TT (AM or PM)A
S (st, nd, rd, th)o
'' (escape characters)[]
[] and {} for range formattingno replacement. formatRange works differently
u (outputs IS08601)use moment's toISOString instead

See the MomentJS formatting characters for the full list of available characters.

Additionally, there are some FullCalendar-specific formatting characters, such as t, T, and ( ).

The following date utility methods have also been affected:

MethodUpgrade Notes
$.fullCalendar.parseDateuse a moment constructor
$.fullCalendar.parseISO8601
$.fullCalendar.formatDateuse a moment's .format() method instead
$.fullCalendar.formatDatesuse $.fullCalendar.formatRange instead

Internationalization

The new lang option provides built-in support for over 40 locales!

Changing the locale affects the default values of many options (such as isRTL and dayNames). However, these options can still be individually overridden if need be.

Other affected locale-related options:

OptionUpgrade Notes
weekNumberCalculationnew "local" option, which is now the default

View a live demo!

Timezones

The new timezone option provides flexible support for arbitrary timezones! The potential values are:

  • false - no timezone (default)
  • "local" - the timezone of the browser
  • "UTC"
  • a specific timezone string like "America/Chicago"

Certain existing options were modified for timezone support:

OptionUpgrade Notes
events as a functionReceives a timezone parameter.
Changes the argument order for callback!
events as a JSON feedMight send a timezone parameter in the request
ignoreTimezoneWas a bad idea in the first place
currentTimezone
(Google Calendar plugin option)
Uses the calendar's timezone option instead

The timezoneParam and now options have been added as well.

View a live demo!

Requesting and Receiving Events

OptionUpgrade Notes
events as a functionReceives a timezone parameter.
Changes the argument order for callback!
events as a JSON feedSends ISO8601 dates for start and end
allDayDefaultDefaults to undefined instead of true to allow for the smart allDay guessing behavior...

When an Event Object’s allDay property is not specified, FullCalendar is now smarter about guessing it. If either the start or end value has a “T” as part of the ISO8601 date string, allDay will become false. Otherwise, it will be true.

forceEventDuration has been added. When true, it will ensure that any event inputted with an empty end date will have that date computed via defaults instead of allowing it to remain null.

Other API Changes

OptionUpgrade Notes
buttonIcons repurposed!Repurposed to affect button icons when themeing is off.
Use themeButtonIcons for when themeing is on.
buttonTextText is now escaped. HTML injection won't work.
viewDisplay callbackPreviously deprecated and now removed
disableDragging
disableResizing

nextDayThreshold as been added to prevent events which span past midnight from appearing as if they are multi-day.

The HTML markup for buttons in the header has changed slightly, as well as the CSS method used to inject icon characters into those buttons.

Timed events (events that are not all-day) can no longer be resized via the mouse in month and the basic views.

AMD Module

FullCalendar now registers itself as an AMD module for use with loaders like RequireJS. When loaded in this manner, it attaches itself to the jquery the AMD system provides.

No More IE7 Support

Official support for IE7 has been dropped but support for IE8 and above remains.