From 3e7987d7bcba17fe9c4bc37c5b1c74b252ff61ae Mon Sep 17 00:00:00 2001 From: Sharon <357275255@qq.com> Date: Tue, 26 Dec 2017 10:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E5=91=A8=E4=BB=A5?= =?UTF-8?q?=E6=98=9F=E6=9C=9F=E4=B8=80=E5=BC=80=E5=A7=8B=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/laydate.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/laydate.js b/src/laydate.js index 0a75401..47a2832 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -391,6 +391,7 @@ ,zIndex: null //控件层叠顺序 ,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发 ,change: null //日期时间改变后的回调 + ,mondayStart: false //是否以周一为一周的开始,默认以周日开始 }; //多语言 @@ -652,7 +653,7 @@ lay.each(new Array(7), function(j){ if(i === 0){ var th = lay.elem('th'); - th.innerHTML = lang.weeks[j]; + th.innerHTML = options.mondayStart ? lang.weeks[(j+1)%7] : lang.weeks[j]; theadTr.appendChild(th); } tr.insertCell(j); @@ -1015,8 +1016,8 @@ //计算当前月第一天的星期 thisDate.setFullYear(dateTime.year, dateTime.month, 1); - startWeek = thisDate.getDay(); - + startWeek = options.mondayStart ? thisDate.getDay()-1 : thisDate.getDay(); + prevMaxDate = laydate.getEndDate(dateTime.month || 12, dateTime.year); //计算上个月的最后一天 thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天