Fullcalendar month and current year

Good night everyone, I'm needing to know if there's a way to catch the month and current year of FullCalendar, when we click forward or backward.

I couldn't figure out what is the event that fires when you click the forward and backward buttons of dates. The idea and having these dates to do the search in a database and bring the events of the month that is being exposed on the screen of Fullcalendar, for example October 2017.

There would be another way to pass this data for the search in the database? I am using an array with json for setFullCalendarEvents = function(){}

Author: Isac, 2017-10-18

1 answers

Good morning everyone! I want to share a solution that I ended up finding. I am using a template that has fullcalendar, so searching in the documentation I found the following solution: I created 3 buttons: forward, backward, today . The function that rescues the displayed date is:

var moment = $('#full-calendar').fullCalendar('getDate');
var dt = moment.format()

We have the following functions that play the role of forward, backward and today:

$('#full-calendar').fullCalendar('prev');

$('#full-calendar').fullCalendar('today');

$('#full-calendar').fullCalendar('next');

Make the calendar move forward, backward and stay on today

I put these functions in the respective buttons:

$(".prev_data").click(function(){ 
    $('#full-calendar').fullCalendar('prev');
     var moment = $('#full-calendar').fullCalendar('getDate');
     alert(moment.format());
});

Ready, I was able to redeem the month / year that is being displayed, when we move forward or backward the months in the calendar. Hug everyone

 0
Author: edson ferrari, 2017-10-18 12:40:07