Globally Modify Default DatePicker Options
Environment
Product | Progress® Kendo UI® DatePicker for jQuery |
Operating System | Windows 10 64bit |
Visual Studio Version | Visual Studio 2017 |
Preferred Language | JavaScript |
Description
How can I globally modify the default options in the Kendo UI for jQuery DatePicker?
Solution
The following example demonstrates how to achieve the desired scenario.
<input id="datepicker" value="10/10/2011" style="width:150px;" />
<br />
<br />
<input id="monthpicker" value="November 2011" style="width:150px" />
<script>
kendo.ui.DatePicker.fn.options.parseFormats = ["MMMM yyyy"];
</script>
<script>
$(document).ready(function() {
// create the DatePicker from an input HTML element
var datepicker = $("#datepicker").kendoDatePicker().getKendoDatePicker();
$("#monthpicker").kendoDatePicker({
// defines the start view
start: "year",
// defines when the calendar will return the date
depth: "year",
// display the month and year in the input
format: "MMMM yyyy"
});
console.log(datepicker.options.parseFormats); // display the set options
});
</script>