I would like to find out how can I limit the fullcalendar to show a three months period and deselectable for the rest of the months like within a datepicker?
E.g. T
I liked lewsid's answer a lot but it has some issues. First of all, the view.start is a Moment, not a date, so getMonth() does not exist. Secondly, a View's start is just the first visible day in that month, meaning that date can be from the previous month. To circumvent this, use its intervalStart property.
Here is my implementation to get the calendar to list the current year.
viewRender: function(view, element) {
var now = new Date(new Date().getFullYear(), 0, 1);
var end = new Date(new Date().getFullYear(), 11, 31);
var calDateString = view.intervalStart.month()+'/'+view.intervalStart.year();
var curDateString = now.getMonth()+'/'+now.getFullYear();
var endDateString = end.getMonth()+'/'+end.getFullYear();
if (calDateString === curDateString) {
jQuery('.fc-prev-button').addClass("fc-state-disabled");
} else {
jQuery('.fc-prev-button').removeClass("fc-state-disabled");
}
if (endDateString === calDateString) {
jQuery('.fc-next-button').addClass("fc-state-disabled");
} else {
jQuery('.fc-next-button').removeClass("fc-state-disabled");
}
}