kendo-datetimepicker: how to set min/max

3.4k views Asked by At

How can I set the min/max after the datetimepicker has been created?

With the datepicker I can do something like this:

var start = $("#start").kendoDatePicker();
start.max(endDate);

However, the datetimepicker won't allow that.

I get the error as

"Uncaught TypeError: start.max is not a function"

1

There are 1 answers

1
himawan_r On

Do it like kendo doc here does, just like this i limit min to yesterday and max to tomorrow :

var datepicker = $("#datepicker").data("kendoDatePicker");

var $today = new Date();
var $yesterday = new Date($today);
$yesterday.setDate($today.getDate() - 1);
var $tomorrow = new Date($today);
$tomorrow.setDate($today.getDate() + 1);

var min = datepicker.min($yesterday);
var max = datepicker.max($tomorrow);

Here is the kendo dojo as working example