如何在datetimepicker中的两个日期之间设置验证?

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');
            }
         }

     });

});

here is the code for validation Between Two dates of datetimepicker.

For More Information Refere this Link

$( document ).ready(function() {

$(function(){
    $('#valid_from').datetimepicker({
        formatDate  :'m-d-Y',   
        format      :'m-d-Y',
        onShow      :function( ct ){
            this.setOptions({
            maxDate :$('#valid_to').val()?$('#valid_to').val():false
            })
        },
    timepicker:false
    });
    $('#valid_to').datetimepicker({
        formatDate  :'m-d-Y',   
        format      :'m-d-Y',
        onShow      :function( ct ){
            this.setOptions({
            minDate :$('#valid_from').val()?$('#valid_from').val():false
            })
        },
    timepicker:false
    });
});

Assuming you are using the Bootstrap Date Time Picker then the below link would help

https://eonasdan.github.io/bootstrap-datetimepicker/#linked-pickers

specifically. this piece of code.

  $(function () {
    $('#datetimepicker6').datetimepicker();
    $('#datetimepicker7').datetimepicker({
        useCurrent: false //Important! See issue #1075
    });
    $("#datetimepicker6").on("dp.change", function (e) {
        $('#datetimepicker7').data("DateTimePicker").minDate(e.date);
    });
    $("#datetimepicker7").on("dp.change", function (e) {
        $('#datetimepicker6').data("DateTimePicker").maxDate(e.date);
    });
});

better option change minDate: new Date() then you are good to go as per your question