Categories
Code

Duplicate events in FullCalendar

I’ve been in calendar hell the last couple of days. I’ve been using and tweaking FullCalendar & been having a lot of duplicate problems with navigating between months, the events would multiply like some sort of weird digital bacteria. But anyway, after spending sometime on it I stumbled upon this post & finally it sorted the issue!

The fix is relatively simple, in your calendar.js file find the Event Manager function and add in:

t.removeEventSources = removeEventSources;
function removeEventSources() {
 sources = [];

 // remove all client events from all sources
 cache = [];

 reportEvents(cache);
}

In your code you then need to add in the following:

$('#calendar').fullCalendar('removeEvents').fullCalendar('removeEventSources').fullCalendar('addEventSource', newURL);

#beerme