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;
}
}
No related posts.
Really nice tip, got it working after lot try, using js calander in magento but could not able to disable previous dates for 3 days now.
Thanks for posting, one question, how we can increase the limit of disable dates?? i mean suppose if need to disable 3 more days from today date then?? appreciate if you reply on this.
Thanks for this information. I was able to disable the previous days. I want to have a start date and end date calendar and I am unable to disable the dates in the end date js. for eg if today is 9/10/12 and start date is 11/10/12 then in the end date I dont want to have dates from 9/10/12 and want it from 11/10/12.
Can you guide me with what needs to be done
thanks
i find the calender.js file in my magento 1.6 i can’t find where i want to change in code.
pls help me