When I edit an allDay event, fullCalendar (2.0.2) is converting it to a non-all day event. When the event is clicked in the calendar view, I load a modal which allows users to edit the details. Selecting allDay or time is not part of this, but date is. Upon clicking submit I fire an AJAX call which updates the event server-side then returns JSON data containing the event id. I then query fullCalendar to get the correct event. At this point allDay
and _allDay
are both still true
:
theEvent = $('#calendar').fullCalendar('clientEvents', data.id)[0];
> theEvent.allDay
true
> theEvent._allDay
true
I then update fullCalendar with the edited event object:
calendar.fullCalendar('updateEvent', theEvent);
After the edit finishes, the event displays in the calendar with 12a
displaying immediately before the event title.
I'm able to track it down to the mutateEvent
function in the fullCalendar which appears to override my settings within the following conditional:
// current values are:
// event.allDay: true
// oldAllDay: true
// newStart: Moment object - Mon Jan 19 2015 00:00:00 GMT-0600 (CST)
// newEnd: null
// detect new allDay
if (event.allDay != oldAllDay) { // if value has changed, use it
newAllDay = event.allDay;
} else { // otherwise, see if any of the new dates are allDay
newAllDay = !(newStart || newEnd).hasTime();
}
I don't think I'm doing anything wrong, but I can't be sure. Anyone have input on this? Please and thanks. At this time I'm not able to upgrade to a more recent version as this version (2.0.2) appears to be somewhat tied in to the Ace Admin Bootstrap theme selected by my client.
Alternately, I'd love to be able to only allow allDay events so that I don't have to worry about this in the future.