$('#mycalendar').fullCalendar({
//maxTime: 20,
//minTime: 13,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
viewDisplay : function(view) {
var now = new Date();
var begin = new Date();
var end = new Date();
// ------- Interval date in calendar
end.setMonth(now.getMonth() + 12); //Adjust as needed
begin.setMonth(now.getMonth()); //Adjust as needed
var cal_date_string = view.start.getMonth()+'/'+view.start.getFullYear();
var cur_date_string = now.getMonth()+'/'+now.getFullYear();
var end_date_string = end.getMonth()+'/'+end.getFullYear();
var begin_date_string = begin.getMonth()+'/'+begin.getFullYear();
if (cal_date_string == begin_date_string) {
jQuery('.fc-button-prev').addClass("fc-state-disabled");
} else {
jQuery('.fc-button-prev').removeClass("fc-state-disabled");
}
if (end_date_string == cal_date_string) {
jQuery('.fc-button-next').addClass("fc-state-disabled");
} else {
jQuery('.fc-button-next').removeClass("fc-state-disabled");
}
},
dayClick: function(myDate, allDay, jsEvent, view) {
var newDate = new Date();
newDate = newDate.getFullYear()+'-'+newDate.getMonth()+'-'+newDate.getDate();
myDate = myDate.getFullYear()+'-'+myDate.getMonth()+'-'+myDate.getDate();
//How many days to add from today?
//var daysToAdd = 15;
//myDate.setDate(myDate.getDate() + daysToAdd);
//newDate.setDate(newDate.getDate());
alert(myDate);
alert(newDate);
if (myDate < newDate) {
//TRUE Clicked date smaller than today + daysToadd
alert("NO - You cannot book on this day!");
} else {
//FLASE...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.