限定最小最大值时必须年月日都赋值
动态限定范围:
定义最小值和最大值
function minYear() {
var now = new Date();
var currYear = now.getFullYear();
console.log(currYear);
var minYear = currYear - 3;
console.log(minYear);
return minYear + "-1-1";
}
function maxYear() {
var now = new Date();
var currYear = now.getFullYear();
console.log(currYear);
return currYear + "12-30";
}
年范围选择器
//年选择器
laydate.render({
elem: '#grade'
, type: 'year'
, min: minYear()
, max: maxYear()
});
这样写是正确的,如果不拼接月和日,将不会显示想要的范围