biggles
biggles

Reputation: 78

Fullcalendar time zones on local side not matching server

I'm using the updated fullcalendar (v2.6.1) library with moment which added better time zone support. The event I have is scheduled for 8pm. I'm seeing the event load as 11pm.

SQL Of Event

Custom event class When the DateTime is set as "start" I'm seeing it use the data from the DB

Console.log

My calendar is loading as follows:

 function loadCalendar(eventList)
    {
        console.log(eventList);
        $('#div_CalendarViewTab').fullCalendar({
            // put your options and callbacks here
            theme: true,
            height: 500,
            ignoreTimeZone:false,
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay',
            },
            eventClick: function (calEvent, jsEvent, view) {
                     //removed for brevity
                }
        });



        $('#div_CalendarViewTab').fullCalendar('removeEvents');
        $('#div_CalendarViewTab').fullCalendar('addEventSource', eventList);
        $('#div_CalendarViewTab').fullCalendar('rerenderEvents');
    }

Does this look like a server-side issue, or am I missing a configuration in fullcalendar to account for the difference in time from server to local?

Update - 2/19/2016

The only thing I've found that actually changes the display (the event on the calendar) is setting the timezone to 'UTC'. The calendar changed to 4am. Otherwise every other timezone (America/Los_Angeles, America/Chicago, local) all display the event at 11pm.

timezone: 'local'

enter image description here

timezone: 'UTC'

enter image description here

Update - 2/27/2016

This problem sounds very familiar to many posts I've found that read "ignoreTimezone not working". One answer I've found fullCalendar ignoreTimezone doesn't seems to work explained that ignoreTimezone was an old setting. To account for this I updated the setting to timezone: false using 2.6.1 to no avail. Next, I located an older version of the fullcalendar library (1.5.4) and added the ignoreTimezone back in which also fails.

I'm starting to look for a different library at this point. The only suggestion I have below implies to use a string instead of a date... but the event object is supposed to use DateTimes so I don't think that will work.

Any other ideas?

Upvotes: 0

Views: 1474

Answers (1)

biggles
biggles

Reputation: 78

The solution for this ended up coming on the object side as opposed to the fullcalendar config. I adjusted the "start" variable of the Event class object to be a string instead of a DateTime. Next, anywhere I saved the start (seen below as EVENTSTART) I used .ToString("o") to get an ISO8601 date (details: Given a DateTime object, how do I get an ISO 8601 date in string format?)

enter image description here

Upvotes: 0

Related Questions