13
votes

I don't know if it is a feature or a bug. But the event end value is set to null if allDay is true. This is the function where the event is updated:

 change: function (eventModel) {


                var currEvId = eventModel.get('_id');
                var fcEvent = $("#calendar").fullCalendar('clientEvents', currEvId)[0] || {};
                 console.log("end before update : " + fcEvent.end);

                fcEvent.title = alvEventModel.get("title");                 
                fcEvent.start = new Date(alvEventModel.get("start"));
                fcEvent.end = new Date(alvEventModel.get("end"));
                fcEvent.allDay = alvEventModel.get("allDay");  //true or false              
                this.el.fullCalendar('updateEvent', fcEvent);

                console.log("start: " + fcEvent.start);
                console.log("end: " + fcEvent.end);      

            },

The console shows

end before update : 1404896400000
end after update: null 

The fullcalendar property forceEventDuration is setted to true

this.$el.fullCalendar({
                    lang: 'sv',
                    header: {
                        left: 'prev,next, today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay',
                        ignoreTimezone: false
                    },
                    forceEventDuration:true,
                    select: this.select,
                    selectable: true,
                    selectHelper: true,
                    editable: true,


                    disableDragging: true,
                    disableResizing: true,

                    aspectRatio: 2.5,
                    height: 600,
                    weekNumbers: true,
                     ...
                    })

the the console shows

end before update : 1404864000000
end after update: 1404813300000 

I this case the rendering for the event is one day. Even after updating with allDay to false it continue to show as a one day event until reloading the events from server. I think the standard behavior is for allDay must have a start and end date. But I'm not sure the intentions of declaring the end date as null. May be I missunderstand the beauty of this behavior. I don't know how to use for my goals. I need an end date like other calendars.

http://jsfiddle.net/Mr_Vertigo/k3RZX/1/ And the version is v2.0.2

3

3 Answers

12
votes

This issue is not because of allday is set to true. Fullcalendar has one issue that if start date and end date are same it simply makes end date as null.

If the event's end date is the same as the start date, FullCalendar considers it to be 1-day in duration (with a blank assumed end time), so it is one-in-the-same. It prefers to store less data than more. So carefully check if start date and end date are coming same.

But you could simply do this as a workaround:

eventClick: function(event) {
    var start = event.start;
    var end = event.end || start;
}

Check following link.

https://code.google.com/p/fullcalendar/issues/detail?id=1014

1
votes

It does not need to be set, because you have defaultAllDayEventDuration option. Also forceEventDuration does not apply to all day events (see here)

If you don't want end to be null, then just set it manualy.

0
votes

FullCalendar always set end to null when allDay changes as you can see in the doc. Line 1886

if (newAllDay != oldAllDay) {
        // if allDay has changed, always throw away the end
        clearEnd = true;
}