Below is the jquery the jquery code to validate start date and end date, if the end date is greater than start date it should display the alert saying please select correct date. i need of disabling previous dates.
$( document ).ready(function() {
$('#valid_from').datetimepicker({
timepicker:false,
closeOnDateSelect:false,
format:'m-d-Y',
changeMonth: true,//this option for allowing user to select month
changeYear: true, //this option for allowing user to select from year range
minDate: 0,
onChangeDateTime: function(dp,$input){
startDate = $("#valid_from").val();
}
});
$('#valid_to').datetimepicker({
timepicker:false,
closeOnDateSelect:false,
format:'m-d-Y',
changeMonth: true,//this option for allowing user to select month
changeYear: true, //this option for allowing user to select from year range
minDate: 0,
onClose: function(current_time, $input){
var endDate = $("#valid_to").val();
if(startDate>endDate){
alert('Please select correct date');
}
}
});
});