I am trying to integrate jquery full calendar plugin.. And I want to disable the past dates for selection.. So I can select only dates starting from current date. How is it possible? How can I filter the dates and specify a condition. I am new to jquery.
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
editable: true,
});
});
In the select method, you are provided with the selected start and end date, and earlier in the method you got the current date in the
datevariable. So just compare them, and if it is less thandate, handle the error.