PDA

View Full Version : CalendarPopup() with month



indisingh
06-29-2005, 06:08 PM
Hi,
I'm trying to populate a CalendarPopup() with 3 dates in ascending order that have been hard coded. Only those dates that are hard coded should be enabled in the popup, rest all the dates should be disabled. All combinations works except '29th, 30th, 1st' or '30th, 31st, 1st'. Perfect example would be today's date i.e 29th June 2005. The popup should show enabled dates as 29th, 30th & 1st, however, it shows these dates as disabled. Here's my code -

var date1 = new Date(2005,06,29);//"06/29/2005"; DATE1
var date2 = new Date(2005,06,30);//"06/30/2005"; DATE2
var date3 = new Date(2005,07,01);//"07/01/2005"; DATE3

var month1 = date1.getMonth()-1;
var month2 = date2.getMonth()-1;
var month3 = date3.getMonth()-1;
date1.setMonth(month1);
date2.setMonth(month2);
date3.setMonth(month3);

var day1 = date1.getDate()-1;
var day11 = date1.getDate()+1;
var day2 = date2.getDate()-1;
var day22 = date2.getDate()+1;
var day3 = date3.getDate()-1;
var day33 = date3.getDate()+1;

var cal17 = new CalendarPopup();

date1.setDate(day1);
cal17.addDisabledDates(null,formatDate(date1,"yyyy-MM-dd"));
date1.setDate(day11);
date2.setDate(day2);
cal17.addDisabledDates((formatDate(date1,"yyyy-MM-dd")),(formatDate(date2,"yyyy-MM-dd")));
date2.setDate(day22);
date3.setDate(day3);
cal17.addDisabledDates((formatDate(date2,"yyyy-MM-dd")),(formatDate(date3,"yyyy-MM-dd")));
date3.setDate(day33);
cal17.addDisabledDates((formatDate(date3,"yyyy-MM-dd")),(null));

Any help is greatly appreciated.

Thanks.