Parse Two-Digit Dates Greater Than 2029
Environment
Product | Progress® Kendo UI® DatePicker for jQuery |
Created with version | 2017.3.1026 |
Description
I am using custom parseFormat
with a two-digit year in the DatePicker. When the value for the year is greater than 29, the year is parsed as 19xx.
How can I implement the parsing of two-digit dates that are greater than 2029?
Solution
This behavior is controlled by the twoDigitYearMax
property whose default value is 2029. As a result, 2029 is the maximum year that can be parsed. To parse years that are greater than 2029, change the property.
<div class="demo-section k-content">
<h4>Show e-mails from:</h4>
<input id="datepicker" title="datepicker" style="width: 100%" />
</div>
<script>
$(document).ready(function () {
kendo.culture().calendar.twoDigitYearMax = 2099;
// create DatePicker from input HTML element
$("#datepicker").kendoDatePicker({
parseFormats: ["dd/MM/yy"]
});
});
</script>