Try this below code:
$(document).ready(function () {
$("#EventDate").datepicker({
dateFormat: "dd-M-yy",
minDate: 0,
onSelect: function () {
var dt2 = $('#EndDate');
var startDate = $(this).datepicker('getDate');
//add 0 days to selected date
startDate.setDate(startDate.getDate() + 0);
var minDate = $(this).datepicker('getDate');
//minDate of dt2 datepicker = dt1 selected day
dt2.datepicker('setDate', minDate);
//sets dt2 maxDate to the last day of 30 days window
dt2.datepicker('option', 'maxDate', startDate);
//first day which can be selected in dt2 is selected date in dt1
dt2.datepicker('option', 'minDate', minDate);
//same for dt1
$(this).datepicker('option', 'minDate', minDate);
}
});
$('#EndDate').datepicker({
dateFormat: "dd-M-yy"
});
});