标签:date() 联动 focus val turn xtend type get 日期
//时间插件 layui.laydate.render({ elem: ‘#date‘, //指定元素 type: ‘month‘ , value: new Date() , max: maxDate() , min: minDate() }); function maxDate() { var now = new Date(); return now.getFullYear() + "-" + (now.getMonth() + 1); } function minDate() { //采集四月份以后的数据 var now = new Date(2020, 4, 1); return now.getFullYear() + "-" + (now.getMonth()) + "-" + (now.getDate()); }
//联动 日期 var laydate = layui.laydate; //开始日期 var insStart = laydate.render({ elem: ‘#start_date‘ , value: new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate() - 1) , max: maxDate() , min: minDate() , done: function (value, date) { //更新结束日期的最小日期 insEnd.config.min = lay.extend({}, date, { month: date.month - 1 }); //自动弹出结束日期的选择器 insEnd.config.elem[0].focus(); } }); //结束日期 var insEnd = laydate.render({ elem: ‘#end_date‘ , value: new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + (new Date().getDate() - 1) , max: maxDate() , min: minDate() , done: function (value, date) { //更新开始日期的最大日期 insStart.config.max = lay.extend({}, date, { month: date.month - 1 }); } }); function maxDate() { var now = new Date(); return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + (now.getDate() - 1); } function minDate() { //采集四月份以后的数据 var now = new Date(2020, 4, 1); return now.getFullYear() + "-" + (now.getMonth()) + "-" + (now.getDate()); }
标签:date() 联动 focus val turn xtend type get 日期
原文地址:https://www.cnblogs.com/zdcblog/p/13354274.html