From 766157f4a914c7c7b7d7aa85e6cd014bca418fdc Mon Sep 17 00:00:00 2001 From: mymij <278904626@qq.com> Date: Thu, 1 Mar 2018 17:02:05 +0800 Subject: [PATCH] =?UTF-8?q?'=E5=BC=B9=E5=87=BA','=E9=87=8D=E7=BD=AE','?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8'=20=E5=A6=82=E6=9E=9C=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4=20=E5=B0=8F=E4=BA=8E=20=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=97=B6=E9=97=B4,=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E4=BB=8E=E6=9C=80=E5=B0=8F=E9=99=90=E5=88=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit '弹出','重置','现在' 如果当前时间 小于 最小限制时间,直接从最小限制时间开始展示 --- src/laydate.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/laydate.js b/src/laydate.js index 0a75401..649a212 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -723,7 +723,7 @@ ,that.position() //定位 ); - that.checkDate().calendar(); //初始校验 + that.checkDate().calendar(null, true); //初始校验 that.changeEvent(); //日期切换 Class.thisElemDate = that.elemID; @@ -993,10 +993,13 @@ }; //日历表 - Class.prototype.calendar = function(value){ + Class.prototype.calendar = function(value, isShowEventInitCalen){ var that = this ,options = that.config - ,dateTime = value || options.dateTime + ,dateTime = value || (options.dateTime = + isShowEventInitCalen && that.newDate(options.dateTime).getTime() < that.newDate(options.min).getTime() ? //'弹出','重置','现在' 如果当前时间 小于 最小限制时间,直接从最小限制时间开始展示 + lay.extend({}, options.min) : options.dateTime + ) ,thisDate = new Date(), startWeek, prevMaxDate, thisMaxDate ,lang = that.lang() @@ -1004,7 +1007,7 @@ ,index = value ? 1 : 0 ,tds = lay(that.table[index]).find('td') ,elemYM = lay(that.elemHeader[index][2]).find('span'); - + if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint('最低只能支持到公元'+ LIMIT_YEAR[0] +'年'); if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint('最高只能支持到公元'+ LIMIT_YEAR[1] +'年'); @@ -1486,7 +1489,7 @@ ,YMD = td.attr('lay-ymd').split('-') ,setDateTime = function(one){ - var thisDate = new Date(); + // var thisDate = new Date(); //useless //同步dateTime one && lay.extend(dateTime, YMD); @@ -1596,7 +1599,7 @@ that.setValue('').remove(); isStatic && ( lay.extend(dateTime, that.firstDate) - ,that.calendar() + ,that.calendar(null, true) ) options.range && ( delete that.startState @@ -1617,7 +1620,7 @@ ,seconds: thisDate.getSeconds() }); that.setValue(that.parse()).remove(); - isStatic && that.calendar(); + isStatic && that.calendar(null, true); that.done(); }