Date Parsing

FullCalendar accepts dates in several formats, wherever its API takes date input. That includes setting the initialDate or defining an event’s start/end. The accepted formats are:

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:00Z — Z 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:

const calendar = new Calendar(calendarEl, {
  timeZone: 'local',
  initialDate: '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.

const calendar = new Calendar(calendarEl, {
  initialDate: 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:

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

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

const calendar = new Calendar(calendarEl, {
  timeZone: 'UTC',
  initialDate: 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.