开始时间不能大于结束时间的方法Layui

    <script>
	    layui.use('laydate', function datatime(){
	    var laydate = layui.laydate;
	    //日期时间
	    var start = laydate.render({
	        elem: '#start_time',
	        type: 'datetime',
	        value: new Date(),
	        calendar: true,
            done: function(value, date, endDate){
            	end.config.min = {
                        year: date.year,
                        month: date.month - 1,
                        date: date.date,
                        hours: date.hours,
                        minutes: date.minutes,
                        seconds: date.seconds
                    }
            	}

    });
	    var end = laydate.render({
		  elem: '#end_time',
		  type: 'datetime',
		  value: new Date(),
		  calendar: true,
	      done: function(value, date){
	    	  start.config.max = {
	    	            year: date.year,
	    	            month: date.month - 1,
	    	            date: date.date,
	    	            hours: date.hours,
	    	            minutes: date.minutes,
	    	            seconds: date.seconds
	    	        }
	      }
	    });
	});

    </script>

  

posted @ 2018-06-26 18:33  念秋竹  阅读(861)  评论(0编辑  收藏  举报