laydate 动态设置最大最小时间

 

/*时间插件*/
	laydate.render({
		elem: '#startTime',
		type: 'month',
		max: 0,
		format: 'yyyy-MM',
		value: defaultDate,
		done: function(value, date, endDate) {
			endLayDate.config.max = {
				year: date.year,
				month: 11,
				date: 31
			};
			endLayDate.config.min = {
				year: date.year,
				month: date.month - 1,
				date: date.date
			};
		},
		change: function(value, date, endDate) {
			loadOrgTree(value, $("#endTime").val());
		}
	});

	/*时间插件*/
	var endLayDate = laydate.render({
		elem: '#endTime',
		type: 'month',
		max: 0,
		format: 'yyyy-MM',
		value: defaultDate,
		done: function(value, date, endDate) {},
		change: function(value, date, endDate) {
			loadOrgTree($("#startTime").val(), value);
		}
	});

 

你可能感兴趣的:(JS,layDate)