由于新版的laydate时间插件在初始化时已设置时间最大最小范围,且生成对象,无法重新渲染改变其日期最大最小值。
有网友经试验贴出如下方法可达成目的,故做记录。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| 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 } } });
|