Evening all, I'm working on a basic calendar delivery script where the calendar has certain dates disabled, like below. Everything looks sharp, I've made weekends not clickable, except I can't disable dates that are old/gone (i.e. yesterday is still a selection). How is it possible to disable these as well? Any input or help is appreciated, I tried defining a new date (d) outside of the function and calling it but didn't have any help with that, <script type="text/javascript"> // -> Checks for the dates we don't want and returns true to disable. function dateStatus(date) { if (date.getDay() == 6) { return true; } else if (date.getDay() == 0) { return true; } else if (date.getDay() != 0) { return false; } else { return false; } } Calendar.setup({ inputField : "delivery_date_time_input", ifFormat : "%A, %d %B %Y", showsTime : false, timeFormat : "12", singleClick : false, dateStatusFunc : dateStatus }); </script> Code (markup):
Quick and dirty, test if a date is less than "l" to check for past days <html> <body> <script type="text/javascript"> var d = new Date(); var l = d.getTime(); l = l - (d.getHours() * 60 * 60 * 1000) - (d.getMinutes() * 60 * 1000) - (d.getSeconds() * 1000); var d2 = new Date(l); document.write(d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() +" " + d.getDate() + '.' + d.getMonth()); document.write("<br>"); document.write(d2.getHours() + ":" + d2.getMinutes() +":" + d2.getSeconds()+ " " + d2.getDate() + '.' + d2.getMonth()); // if Date.getTime() < l then its a past day </script> </body> </html> Code (markup):