FullCalendar - eventDrop UTC date

I installed this FullCalendar demo:

http://jsfiddle.net/k5de79b3/

           eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
                var eventData = {};
                eventData.event_id = event.id;
                eventData.start = event.start.toDate();

                var year = eventData.start.getUTCFullYear();
                var month = eventData.start.getUTCMonth() + 1;
                var day = eventData.start.getUTCDate();
                var hours = eventData.start.getUTCHours();
                var minutes = eventData.start.getUTCMinutes();
                var seconds = eventData.start.getUTCSeconds();
                if(month < 10){ month = '0' + month; }
                if(day < 10){ day = '0' + day; }
                if(hours < 10){ hours = '0' + hours; }
                if(minutes < 10){ minutes = '0' + minutes; }
                if(seconds < 10){ seconds = '0' + seconds; }

                eventData.start = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
                alert(eventData.start);
            }

      

to show how the date / time returned for a dropped event is misleading.

The calendar handler is configured to return the UTC time and UTC of the discarded event. However, you will notice that if you release the event on 11/10/2014 08:00:00 this is the time that is returned.

I am in pacific time zone ( -8 ), so if I use the calendar and drop the event at 2pm (my local time) UTC time returns 10pm ?

Has anyone else noticed this behavior?

+3


source to share


1 answer


To get the results you want, you need to add timezone:'local'

when you initialize the calendar.

The default for timezone

FullCalendar is "no timezone", as stated in the docs . So no, this does not include your local time.



View the differences with this more readable version of your code when you posted (no timezone) versus the version where it will use your timezone .

+8


source







All Articles