I am trying to count the events per day on fullcalendar but I am getting the wrong output. what I am trying to do is group and count the event per day and group by resources. but the output is just grouping it and assigning it on the 1st resource group
This is my fiddle
eventRender: function(event, element) {
flagEvent(event, element);
if (event.end && event.start.format('YYYY-MM-DD') !== event.end.format('YYYY-MM-DD')) {
while (event.end > event.start) {
event.start.add(1, 'day');
console.log('flag', event.start.format('YYYY-MM-DD'))
flagEvent(event, element);
}
}
},
eventAfterAllRender: function(view) {
$('#calendar .fc-day.fc-widget-content').each(function(i) {
var date = $(this).data('date'),
count = $('#calendar a.fc-event.event-on-' + date).length;
if (count > 0) {
$(this).html('<div class="fc-event-count">' + (count) + '<div>');
} else {
$(this).html('<div class="fc-event-count"><div>');
}
});
},
This should be the output base on the given data: