layUI Form start time is less than end time control


layUI For two independent time input boxes, there is no control method of who is the little fish , Handwriting required , The specific code is as follows :

<form  action="xxx.action" method="post" class="form-inline" >
 Starting time :<input type="text" name="startTime" id="startT"/>
 End time :<input type="text" name="endTime" id="endT" />
</form>
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  $ = layui.$;
  laydate.render({
    elem: '#startT', // Corresponding to the input box at the beginning of the form id
    type: 'datetime' ,//  Type of month, year, day, hour, minute and second  , There are other types of (time: Minutes and seconds ,date: Date, etc ), Don't write type Property default date type 
    done: function () {
		var startDate = new Date($('#startT').val());
		var endDate = new Date($('#endT').val());
		if(startDate!=null){
  			if(endDate!=null){
  				if (endDate < startDate) {
  					layer.closeAll();
  		  			layer.msg(' The end time cannot be less than the start time ');
  		  		}
  			}
  		}
	}
  });
  laydate.render({
      elem: '#endT', // Corresponding to the input box at the end of the form id
      type: 'datetime',
      done: function () {
  		var startDate = new Date($('#startT').val());
  		var endDate = new Date($('#endT').val());
  		if(startDate!=null){
  			if(endDate!=null){
  				if (endDate < startDate) {
  					layer.closeAll();
  		  			layer.msg(' The end time cannot be less than the start time ');
  		  		}
  			}
  		}
	} 
  });
});
</script>

pass: Start time and end time should be judged , Because I'm not sure whether to fill in the start time or the end time first ;


《END》