set the max date on kendo date picker from client side

datepicker, javascript, jquery, kendo-ui

Solution

You have to use the `setOptions()` method to change that:

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

datepicker.setOptions({
    max: new Date(today.setDate(today.getDate()+30))
});

Or if you want just do this in the initialization:

$("#datepicker").kendoDatePicker({
    max: new Date(today.setDate(today.getDate()+30))
});

Problem

I have this: ``` var today = new Date(); ``` Updating the kendo datepicker: ``` $('#datepicker').kendoDatePicker({ max: today.setDate(today.getDate()+30); }); ``` In the debugger the max value is `1404408808080` but in today variable the date is right one `2014-07-03T17:3`. Want to set the max date for kendodatepicker 30 days from the current date.

Original source