0

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?

Community
  • 1
  • 1
biggles
  • 68
  • 2
  • 9
  • try with timezone: 'local' – Chintan Mirani Feb 19 '16 at 06:28
  • No dice @ChintanMirani. The update I made was "height: 500, timezone: 'local' header: {"... and I'm still seeing the console.log start as Thu Feb 18 2016 23:00:00 GMT-0500 (Eastern Standard Time) – biggles Feb 20 '16 at 03:56
  • I've faced this problem before, unfortunately I could not identify the problem, I was doing the exact thing like you and the "solution" for me was using the start and end like "string" directly from mvc, You can read the datetime from the database, but the you could change the format to `YourDate.ToString("yyyy-MM-dd HH:mm:ss")` and that way it kept the database time exactly. It's not a great solution but you can try it if it's urgent or something – Jorge F Feb 24 '16 at 02:38

1 Answers1

0

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

Community
  • 1
  • 1
biggles
  • 68
  • 2
  • 9