Monday, January 23, 2012

Arshaw Full Calendar - Timezone fix

When we are pulling date from the server having UTC, it may display in local timezone format in Arshaw's Full Calendar. This is due to the misconfiguration in the full calendar function we are using. 

There is a constant for avoiding the timezone ie. ignoreTimezone, When parsing ISO8601 dates, whether UTC offsets should be ignored while processing event source data. The default is true, which means the UTC offset for all ISO8601 dates will be ignored. For example, the date "2008-11-05T08:15:30-05:00" will be processed as November 5th, 2008 at 8:15am in the local offset of the browser.

The below sample code shows how to use the ignoreTimezone in fullcalendar to avoid the local time constraint.

            eventSources: [
                ignoreTimezone: true
// For ignoring timezone
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            editable: false,
Post a Comment

Popular Posts