设置成时间的默认最大可选值为当前日期。参考代码:
//日期
var nowTime=new Date();
var startTime=laydate.render({
elem:'#startTime',
type:'datetime',
btns: ['confirm'],
max:'nowTime',//默认最大值为当前日期
done:function(value,date){
// console.log(value); //得到日期生成的值,如:2017-08-18
// console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
endTime.config.min={
year:date.year,
month:date.month-1,//关键
date:date.date,
hours:date.hours,
minutes:date.minutes,
seconds:date.seconds
};
}
})