Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Date Control API > Methods

JavaScript API: Date Control API > getAllowedInterval()

Scroll Prev Next More

 

This method returns the allowed interval for the selected Date control.

Syntax

ctrl.getAllowedInterval()

Arguments

No arguments.

Return value

Returns the [start, end] array as a JavaScript Date object.

Example

getAllowedInterval() can be used in the JavaScript OnLoad event, as well as any other JavaScript event.

 

Set the allowed interval and then make the interval have an open upper boundry:

 

var ctrl = Runner.getControl(pageid, 'datefield');
//set the allowed interval
ctrl.setAllowedInterval( '2019-12-10', '2019-12-24', 'error message' );
//........................
//get the allowed interval
var interval = ctrl.getAllowedInterval();
//get the lower boundry of the interval
start_date = interval[0];
//set the new allowed interval with an open upper boundry
ctrl.setAllowedInterval( start_date, null );

 

Note: replace "datefield" and "error message" with the actual field name and error message in the function.

See also:

JavaScript API: Control object > getControl()

JavaScript API: Date Control API > setAllowedInterval()

"Edit as" settings: Date

"Edit as" settings

Date control API

JavaScript API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software