When a user clicks on a day slot in a month view in the Fullcalendar dayClick event I’d like to have an alert saying that this date is not available. There are dates on a Calendar that are blocked, for example 12/10/2012 – 12/14/2012.
I wrote this code, but since I’m a newbie, I need that somebody please help me to understand what is wrong here:
dayClick: function (date, allDay, jsEvent, view) {
var myDate=new Date();
myDate.setFullYear(2012,11,10);
var deadline=new Date();
deadline.setFullYear(2012,11,14);
if (myDate <= deadline)
{
alert("No reservations available");
return false;
}
The fullcalendar is integrated in a ASP.NET MVC app.
Thank you very much for your help!
Check this fiddle – http://jsfiddle.net/100thGear/zBZrs/
You need to compare the
dateparameter that gets passed to thedayClickeventCallback to your deadlines.Let me know if this helps.