how to set min date for kendo datetime picker

jestges picture jestges · Jul 25, 2013 · Viewed 17.8k times · Source

Hi I've a kendo template and that template contains a textbox like below with datetime picker.

<script id="popup_editor" type="text/x-kendo-template">
    <input data-role="datepicker" data-bind="value: datePickerValue" />
</script>

Now I want to set min value for this. i.e I dont want to permit to select previous days than today.

Any example?

Answer

Janie B picture Janie B · Jul 25, 2013

Try this

var myDatePicker = $("#myDatePicker").kendoDatePicker().data("kendoDatePicker");
var today = new Date();
var day = today.getDate();
var month = today.getMonth() + 1;
var year = today.getFullYear();
myDatePicker.min(new Date(year,month,day));