Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Daniel on Apr 29, 2008 10:06
open dhtmlx forum
Sensitive date range in calendar

I have two calendars attached to inputs. I want to set the range of one calendar based on what is selected in the first one.


....
var cal1 = new dhtmlxCalendarObject ('input1');
cal1.attachEvent("onClick",setCalendarTwo);
cal1.setDateFormat("%m/%d/%Y");

function setCalendarTwo(date){

    dateFrom = cal1.getFormatedDate(null,date);
    var cal2 = new dhtmlxCalendarObject('input2');
    cal2.setSensitive(dateFrom, null);
    cal2.setDateFormat("%m/%d/%Y");

}

I would like dateFrom be one day after the selected date. So if 4/25/08 is selected in cal1, then I want the sensitive range for cal2 to begin at 4/26/08. How can I achieve this?

Thanks,
Daniel
Answer posted by Support on Apr 30, 2008 01:33
>>I would like dateFrom be one day after the selected date.

You can use code similar to next
    cal1.setOnClickHandler(function(date){
       cal2.setSensitive(new Date(date.valueOf()+3600*24*1000), null);
       return true;
    });