logo

FullCalendar

This version is a pre-release. Read the release notes

Date Parsing

FullCalendar’s API accepts date information in many places, such as when you set the defaultDate or define an event’s start/end. FullCalendar accepts a number of formats for these dates:

ISO8601 strings

ISO8601 string are the most common way to express dates. They are compact, readable, and offer the ability to specify time zone information, known as the “UTC offset”. Some examples of ISO8601 dates:

  • 2018-06-01T12:30:00-05:00 — has a -05:00 UTC offset
  • 2018-06-01T12:30:00ZZ signifies 00:00 UTC offset
  • 2018-06-01T12:30:00 — no UTC offset specified. parsing will depend on the timeZone
  • 2018-06-01 — no UTC offset specified. parsing will depend on the timeZone

Example:

var calendar = new Calendar(calendarEl, {
  timeZone: 'local',
  defaultDate: '2018-06-01' // will be parsed as local
})

Millisecond Time

You can supply a millisecond time since the Unix epoch (Jan 1, 1970 UTC). Please specify this in milliseconds, NOT seconds. Seconds are not supported.

var calendar = new Calendar(calendarEl, {
  defaultDate: 1537302134028 // Tue Sep 18 2018 16:22:14 GMT-0400
})

Native JavaScript Dates

You can specify a native JavaScript Date object. The native Date constructor accepts local values, so it is best used with the local time zone:

var calendar = new Calendar(calendarEl, {
  timeZone: 'local',
  defaultDate: new Date(2018, 8, 1)
})

If you want to specify UTC values, use this technique:

var calendar = new Calendar(calendarEl, {
  timeZone: 'UTC',
  defaultDate: new Date(Date.UTC(2018, 8, 1))
})

Please note that it is not possible to serialize Date objects into JSON, thus it is not possible to use Date objects in a JSON feed event source.