Fullcalendar display the count of events per day

12,733

I hope this helps someone but don't know if it's the exact answer you're looking for.

To get the number of events that occur on a day you can use the following code:

$('#calendar').fullCalendar( 'clientEvents', function(eventObj){
    if (eventObj.start.isSame('2014-11-21')) {
        return true;
    } else {
        return false;
    }
}).length;

As per fullcalendar documentation you can search for events with a filter function clientEvents.

The if statement in the function compares dates using moment.js which is included in fullcalendar 2.0

Share:
12,733
user3061121
Author by

user3061121

Updated on June 04, 2022

Comments

  • user3061121
    user3061121 about 2 years

    I using the FullCalendar and i would like display the count of events per day in all views for each days.

    Example :

    <div class="fc-day-number">1</div>
    

    Change to :

    <div class="fc-day-count">X</div>
    <div class="fc-day-number">1</div>
    

    Please find a screenshoot as example: link

    Thanks in advance