setValue

selects a date in the calendar

boolean setValue(Date|Date[]|string|string[] date);

Parameters

dateDate|Date[]|string|string[]the date to select

Returns

booleandefines, whether a date has been successfully added into the calendar

Example

// sets the current date
calendar.setValue(new Date());
 
// sets the current date as an array of Date value
calendar.setValue([new Date()]);
 
// sets a date as a string
calendar.setValue("30/05/19");
 
// sets a date as an array of string value
calendar.setValue(["30/05/19"]);
 
//sets dates as an array of Date values(for the range mode)
calendar.setValue([new Date(2019,05,03), new Date(2019,05,19)]);
 
//sets dates as an array of string values(for the range mode)
calendar.setValue(["03/06/19", "15/06/19"]);

Related samples

Details

Please note that the format of date in the Calendar is defined by the dateFormat option. So, check that you've set the format of date you want to use in the calendar both in the setValue() method and in the dateFormat property. Otherwise, the default format ("%d/%m/%y") will be used.

See also
Back to top