edit doc

Date Parsing

FullCalendar’s API accepts date information in many places, such as when you set the initialDate 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

Note that Fullcalendar is only accepting ISO8601 strings in the extended format. Therefore, something like "1981-04-05" will be accepted but "19810405" will not. An exeption to this behaviour is when the RRule Plugin is used AND the rrule is supplied as a string.

Example:

var 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.

var 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:

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

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

var 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.