How to disable previous days in DHTML JS Calendar
If you are using the DHTML JS Calendar and is trying to disable the previous days, by doing so
function dateRange(date) {
var now = new Date();
return (date.getTime() <= now.getTime() )
}
Calendar.setup({
inputField : “calendar”,
ifFormat : “%m/%d/%Y %H:%M %p”,
dateStatusFunc : dateRange,
showsTime : true,
timeFormat : “12″
});
you’ll notice that, you can’t CHOOSE any of the future dates.
The solution is from here, but i’ll repost. Edit your downloaded version of “calendar.js” and change as follows
(line 578)
Calendar.cellClick = function(el, ev) {
…
(line 592)
cal.date.setDateOnly(el.caldate);
date = cal.date;
if (date) {
Calendar.removeClass(cal.currentDateEl, “selected”);
Calendar.addClass(el, “selected”);
closing = (cal.currentDateEl == el);
if (!closing) {
cal.currentDateEl = el;
}
}