I use fullcalendar from http://fullcalendar.io/ . I need to get the number of free time slot when view type is month.
Task: month view. If day has free time slot (without events) day must be green color and user can click on this day. If day is full then color is red and user cannot click.
I have no idea how i can do this and I will be glad if anyone help me.
function eventAfterAllRenderFunction(view) {
if (view.name == "month") {
var arrDate = [];
$('#calendar').fullCalendar('clientEvents', function (eventObj) {
arrDate[arrDate.length] = moment(eventObj.start).format('YYYY-MM-DD');
});
//console.log(arrDate);
var i = 0;
var count = 20;
while (i < arrDate.length - 1) {
if (arrDate[i] == arrDate[i + 1]) {
count--;
if (count == 0)
$("td[data-date=" + arrDate[i] + "]").css('background-color', '#FA8072'); //red
}
else {
count = 20;
}
i++;
}
}
}