m-datetime-picker
Advanced tools
Comparing version 1.0.3 to 1.0.4
28
index.js
@@ -43,3 +43,3 @@ 'use strict'; | ||
for (var i = min; i <= max; i++) { | ||
arr.push(i < 10 ? '0' + i : i); | ||
arr.push(i < 10 ? '0' + i : '' + i); | ||
} | ||
@@ -143,5 +143,9 @@ return arr; | ||
_this.secondsIndex = _this.fmtAry.indexOf('s'); | ||
_this.minDate = new Date(props.minDate + 'T16:00:00'); | ||
_this.maxDate = new Date(props.maxDate + 'T15:59:59'); | ||
var minDateArr = props.minDate.split('-'); | ||
_this.minDate = new Date(+minDateArr[0], minDateArr[1] - 1, +minDateArr[2]); | ||
var maxDateArr = props.maxDate.split('-'); | ||
_this.maxDate = new Date(+maxDateArr[0], maxDateArr[1] - 1, +maxDateArr[2]); | ||
_this.options = { | ||
@@ -220,2 +224,20 @@ defaultValue: _this.getDefaultValue.bind(_this)(), | ||
} | ||
// check minDate , maxDate | ||
var minDateArr = picker.props.minDate.split('-'); | ||
var minDate = new Date(+minDateArr[0], minDateArr[1] - 1, +minDateArr[2]); | ||
var maxDateArr = picker.props.maxDate.split('-'); | ||
var maxDate = new Date(+maxDateArr[0], maxDateArr[1] - 1, +maxDateArr[2]); | ||
var valuesDate = new Date(+values[0], values[1] - 1, +values[2]) | ||
if (+valuesDate < +minDate) { | ||
month = minDateArr[1] | ||
currentValue = minDateArr[2]; | ||
cols[this.monthIndex].setValue(month); | ||
} else if (+valuesDate > +maxDate) { | ||
month = maxDateArr[1] | ||
currentValue = maxDateArr[2]; | ||
cols[this.monthIndex].setValue(month); | ||
} | ||
cols[this.dateIndex].setValue(currentValue); | ||
@@ -222,0 +244,0 @@ } |
{ | ||
"name": "m-datetime-picker", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "m-datetime-picker 日期时间选择器,基于m-picker扩展来", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25242
244