Re[2]: Not selectable dates
2007/04/03 21:35
Viewed 31213 times
Replies: 1/1

When I impliment your code suggestion, my variation shown below, I get some strange behavior:

Calendar.setup({
inputField : "matched_level1",
ifFormat : "%m/%d/%Y",
button : "f_trigger_a",
align : "Tr",
singleClick : true,
dateStatusFunc : dateStatus1
});
function dateStatus1(date) {
var min = new Date(2007,04,03); // Today's date...
var max = new Date(2008,04,03); // Year in the future...
if (date.getTime() < min.getTime() || date.getTime() > max.getTime()) {
return true; // true says "disable"
} else {
return false; // leave other dates enabled
}
}

The calendar displays fine but instead of dates between today (04/03/2007 in my example) and a year from now (04/03/2008) being selectable, the calendar only allows dates 1 month from now (05/03/2007) to a year + 1 month from now (05/03/2008).

Any idea why?

  • b
Re[3]: Not selectable dates
2008/02/13 02:46
Viewed 13308 times
Replies: 0/0
Remember that when constructing a new Date() object, the month parameter is the INDEX of the month: 0 = January, 1 = February.... If you're trying to set the date "April 3, 2007", you need to construct it as: new Date(2007,3,3). Or pass it as a formal string: new Date("April 3, 2007");
last
Google