Setting a Date Range for a Target Calendar

Topics:

How to:

The IbComposer_setCalendarDatesRange function sets the range for the target calendar, given the date on the source calendar and a range in days.

Syntax: How to Set a Date Range for a Target Calendar

IbComposer_setCalendarDatesRange(elementId, fromDate, toDate)

where:

elementID

Alphanumeric

Is the unique identifier of the target calendar control for which you want to set the date range.

fromDate

Date object

Is the value of the date from the source calendar.

Note: This can be obtained by using the IbComposer_getCurrentSelection function. This function should have the third parameter set to True to return a Date object.

toDate

Date object

This value must be calculated using fromDate and the number of days needed to show the range.

Example: Setting the Date Range for a Target Calendar

function button1_onclick(event) {
var eventObject = event ? event : window.event;
var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here
     var curDate = IbComposer_getCurrentSelection('calendar1', 0, true);
       var fromDate= new Date(curDate);
       var toDate = new Date();
       var nOfDays= IbComposer_getCurrentSelection('slider1');
       if (isNaN (nOfDays-0)&& nOfDays != null) {
            alert("Please enter a numeric value!!");
       }
       else {
           var time = fromDate.getTime()+(nOfDays*3600000 * 24);
           toDate.setTime(time);
           IbComposer_setCalendarDatesRange("calendar2", fromDate, 
           toDate);
       }
}

Learn More

For more information, see the Function:IbComposer_setCalendarDatesRange topic in the App Studio technical content.

WebFOCUS

Feedback