Fullcalendar.js get events of the day on click

10,692

You can always iterate over all events and find out which event is on selected day. Here is my function to do that:

function getEvents(date){
        all_events.forEach(function(entry) {
            if (entry['start'] == date.format()){
                alert(entry['title']);}
            else if (entry['start'] <= date.format() && entry['end'] >= date.format()){
                alert(entry['title']);}
         });

    }

You can see my DEMO.

If you click on date 2014-10-06 there will be 2 events that will shows up in alert. Click on date 2014-10-07 will alert only one event.

Share:
10,692
Alex Chizhov
Author by

Alex Chizhov

Web-developer from Yekaterinburg, Russia.

Updated on June 04, 2022

Comments

  • Alex Chizhov
    Alex Chizhov almost 2 years

    Fullcalendar.js get events of the day on click

    Is it possible to get all events of the day I click on in the monthview and print them in any div element with Fullcalendar.js?

    Here's my JSFiddle:

    http://jsfiddle.net/alexchizhov/syf9ycbc/4/

  • Alex Chizhov
    Alex Chizhov over 9 years
    Thank you! I already did it actually with moments.js and jquery heres my demo: http://jsfiddle.net/syf9ycbc/8/. Now Im looking for the way to highlight days numbers that have events, instead of showing events in the calendar, so user can only see them when clicks on a day.