FullCalendar month and current year

1

Good evening everyone, I'm wondering if there is a way to get the month and current year of FullCalendar , when we click on go back or forward.

I could not figure out which event fires when you click the forward and reverse dates buttons. The idea is to have these dates to do the search in a database and bring the events of the month that is being exposed in the Fullcalendar screen, for example October 2017.

Would there be another way to pass this data to the search in the database? I'm using an array with json for setFullCalendarEvents = function(){}

    
asked by anonymous 18.10.2017 / 02:47

1 answer

0

Good morning everyone! I want to share a solution that I found. I'm using a template that has fullcalendar, so by searching the documentation I found the following solution: I created 3 buttons: forward, backward, TODAY. The function that retrieves the date displayed 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, back, and stay TODAY

I put these functions on the respective buttons:

$(".prev_data").click(function(){ 
    $('#full-calendar').fullCalendar('prev');
     var moment = $('#full-calendar').fullCalendar('getDate');
     alert(moment.format());
});
Okay, I've been able to redeem the month / year that's being shown, as we move forward or backward through the calendar months. Hugs to all

    
18.10.2017 / 14:40