Set the maximum date for choosing the client-side kendo date

I have it:

var today = new Date();

Kendo Datpicker Update:

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

In the debugger, the maximum value 1404408808080, but in the current variable, the date is correct 2014-07-03T17:3. Want to set a maximum date for kendodatepicker 30 days from the current date.

+6
source share
3 answers

You must use the method setOptions()to change this:

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

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

Or, if you want, just do this on initialization:

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

setDate ( , ); Date, :

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

He worked the same way

         var today = new Date();
         var maxDate = today.setDate(today.getDate()+30);
         $('#datepicker').kendoDatePicker({
         max: new Date(maxDate) });
+1
source

Source: https://habr.com/ru/post/1543109/


All Articles