I am creating an HTML5 Telerik Report. I have two parameters like Start Date and End date. I want to validate these parameters in such a way that the duration between start date and end date is not more than 6 month.
One way is to subscribe to the start DatePicker's Change event after initialization. From there you can set the Max value for the end DatePicker.
<script>
$(document).ready(function () {
const startDate = $("#startDate").data("kendoDatePicker");
const endDate = $("#endDate").data("kendoDatePicker");
startDate.bind("change", function() {
// Get the date 6 months after the selected startDate value.
let maxDate = this.value();
maxDate = maxDate.setMonth(maxDate.getMonth() + 6);
// Set the Max date for the endDate DatePicker.
endDate.max(new Date(maxDate));
});
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.