修复报错

pull/62/head
sentsin 2017-09-03 18:15:54 +08:00
parent 7c4c57b55b
commit 286a40b202
4 changed files with 20 additions and 13 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.4",
"version": "5.0.5",
"alias": "laydate",
"description": "日期与时间组件",
"main": "src/laydate.js",

View File

@ -1,6 +1,6 @@
/**
@Name : layDate 5.0.4 日期时间控件
@Name : layDate 5.0.5 日期时间控件
@Author: 贤心
@Sitehttp://www.layui.com/laydate/
@LicenseMIT
@ -55,7 +55,7 @@
}
,laydate = {
v: '5.0.4'
v: '5.0.5'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@ -440,9 +440,6 @@
if(!options.elem[0]) return;
//默认赋值
options.value && that.setValue(options.value);
//日期范围分隔符
if(options.range === true) options.range = '-';
@ -536,6 +533,15 @@
if(options.show || isStatic) that.render();
isStatic || that.events();
//默认赋值
if(options.value){
if(options.value.constructor === Date){
that.setValue(that.parse(0, that.systemDate(options.value)));
} else {
that.setValue(options.value);
}
}
};
//控件主体渲染
@ -1211,6 +1217,7 @@
if(index === 0){
dateTime[type] = ym;
if(isAlone) that.startDate[type] = ym;
that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0);
} else { //范围选择
if(isAlone){ //非date/datetime类型
that.endDate[type] = ym;
@ -1337,12 +1344,12 @@
};
//转义为规定格式的日期字符
Class.prototype.parse = function(state){
Class.prototype.parse = function(state, date){
var that = this
,options = that.config
,dateTime = state
,dateTime = date || (state
? lay.extend({}, that.endDate, that.endTime)
: (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime)
: (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime))
,format = that.format.concat();
//转义为规定格式