pull/62/head
sentsin 2017-08-30 18:01:51 +08:00
parent e0f5c6f312
commit 44a0847074
4 changed files with 44 additions and 16 deletions

4
dist/laydate.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "layui-laydate",
"version": "5.0.2",
"version": "5.0.3",
"alias": "laydate",
"description": "日期与时间组件",
"main": "src/laydate.js",
@ -10,7 +10,7 @@
},
"repository": {
"type": "https",
"url": "https://github.com/sentsin/laydate.git"
"url": "git+https://github.com/sentsin/laydate.git"
},
"author": "贤心",
"homepage": "http://www.layui.com/laydate/",
@ -21,5 +21,20 @@
"gulp-rename": "^1.2.2",
"gulp-header": "^1.8.8",
"del": "^2.2.2"
}
},
"bugs": {
"url": "https://github.com/sentsin/laydate/issues"
},
"directories": {
"test": "test"
},
"dependencies": {},
"keywords": [
"laydate",
"date",
"time",
"datetime",
"datepicker",
"calendar"
]
}

View File

@ -1,6 +1,6 @@
/**
@Name : layDate 5.0.2 日期时间控件
@Name : layDate 5.0.3 日期时间控件
@Author: 贤心
@Sitehttp://www.layui.com/laydate/
@LicenseMIT
@ -55,7 +55,7 @@
}
,laydate = {
v: '5.0.2'
v: '5.0.3'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@ -945,7 +945,6 @@
,options = that.config, timestrap = {}
,dateTime = options[index > 41 ? 'endDate' : 'dateTime']
,isOut, thisDateTime = lay.extend({}, dateTime, date || {});
lay.each({
now: thisDateTime
,min: options.min
@ -1118,12 +1117,18 @@
lay.each(new Array(15), function(i){
var li = lay.elem('li', {
'lay-ym': yearNum
});
}), ymd = {year: yearNum};
yearNum == listYM[0] && lay(li).addClass(THIS);
li.innerHTML = yearNum + text;
ul.appendChild(li);
that.limit(lay(li), {year: yearNum}, index);
if(yearNum < that.firstDate.year){
ymd.month = options.min.month;
ymd.date = options.min.date;
} else if(yearNum > that.firstDate.year){
ymd.month = options.max.month;
ymd.date = options.max.date;
}
that.limit(lay(li), ymd, index);
yearNum++;
});
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1])
@ -1132,12 +1137,16 @@
lay.each(new Array(12), function(i){
var li = lay.elem('li', {
'lay-ym': i
});
}), ymd = {year: listYM[0], month: i};
i + 1 == listYM[1] && lay(li).addClass(THIS);
li.innerHTML = lang.month[i] + (isCN ? '月' : '');
ul.appendChild(li);
that.limit(lay(li), {year: listYM[0], month: i}, index);
if(listYM[0] < that.firstDate.year){
ymd.date = options.min.date;
} else if(listYM[0] > that.firstDate.year){
ymd.date = options.max.date;
}
that.limit(lay(li), ymd, index);
});
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
.html(listYM[0] + text);
@ -1704,8 +1713,12 @@
//选择年月
lay(header[2]).find('span').on('click', function(e){
var othis = lay(this)
,layYM = othis.attr('lay-ym').split('-')
,layYM = othis.attr('lay-ym')
,layType = othis.attr('lay-type');
if(!layYM) return;
layYM = layYM.split('-');
that.listYM[i] = [layYM[0] | 0, layYM[1] | 0];
that.list(layType, i);