由于新版的laydate时间插件在初始化时已设置时间最大最小范围,且生成对象,无法重新渲染改变其日期最大最小值。

有网友经实验贴出如下方法可达成目的,故做记录。

//开始时间
var startDate = laydate.render({
elem: '#start',
done: function (value, date) {
endDate.config.min = {
year: date.year,
month: date.month-1,
date: date.date,
hours: date.hours,
minutes: date.minutes,
seconds: date.seconds
}
}
});
//结束时间
var endDate = laydate.render({
elem: '#end',
done: function (value, date) {
startDate.config.max = {
year: date.year,
month: date.month-1,
date: date.date,
hours: date.hours,
minutes: date.minutes,
seconds: date.seconds
}
}
});
05-20 17:52