I need to retrieve all events from my calendar and then retrieve all the days that have an event.
I've already tried
$("#calendar").fullcalendar("getSource");
but iss does not work
I need to retrieve all events from my calendar and then retrieve all the days that have an event.
I've already tried
$("#calendar").fullcalendar("getSource");
but iss does not work
To capture all events, use:
// Obter array de eventos
var eventos = $('#calendar').fullCalendar('clientEvents');
This command will return an array with all events, and therefore within each event has a start date and an end date. You can go through this array and get all the start dates of each event:
// Criar um array para armazenar os dias que tem evento
var dias = [];
// Percorrer array de eventos armazenando os dias que ainda não estão no array
eventos.forEach(function(evento){
var data = evento.start._d;
var dataString = data.getFullYear() + '-' + data.getMonth() + '-' + data.getDate();
if(dias.indexOf(dataString) < 0){
dias.push(dataString);
}
});