//设置开始时间 var startDate = laydate.render({ elem: '#start_date',//开始时间选择控件id min:'2018-6-1', type: 'datetime', format: 'yyyy-MM-dd HH:mm', //可任意组合 done: function (value, date) { if (value !== '') { endDate.config.min.year = date.year; endDate.config.min.month = date.month - 1; endDate.config.min.date = date.date; endDate.config.min.hours=date.hours; endDate.config.min.minutes=date.minutes; } else { endDate.config.min.year = ''; endDate.config.min.month = ''; endDate.config.min.date = ''; endDate.config.min.hours = ''; endDate.config.min.minutes = ''; } } }); //设置结束时间 var endDate = laydate.render({ elem: '#end_date',//结束时间选择控件id type: 'datetime', format: 'yyyy-MM-dd HH:mm', //可任意组合 done: function (value, date) { if (value !== '') { startDate.config.max.year = date.year; startDate.config.max.month = date.month - 1; startDate.config.max.date = date.date; startDate.config.max.hours = date.date; startDate.config.max.minutes = date.date; } else { startDate.config.max.year = ''; startDate.config.max.month = ''; startDate.config.max.date = ''; startDate.config.max.hours = ''; startDate.config.max.minutes = ''; } } });