fix: rangePicker validator check failed for prop value is [undefined, undefined]

pull/177/head
tangjinzhou 7 years ago
parent b8b0604622
commit 228f4478a5

@ -57,7 +57,7 @@ export const MonthPickerProps = () => ({
})
function isMomentArray (value) {
if (Array.isArray(value)) {
return value.length === 0 || !!value.find((val) => val === undefined || moment.isMoment(val))
return value.length === 0 || value.findIndex((val) => val === undefined || moment.isMoment(val)) !== -1
}
return false
}

@ -22,7 +22,7 @@ export function generateShowHourMinuteSecond (format) {
}
function isMoment (value) {
if (Array.isArray(value)) {
return value.length === 0 || !!value.find((val) => val === undefined || moment.isMoment(val))
return value.length === 0 || value.findIndex((val) => val === undefined || moment.isMoment(val)) !== -1
} else {
return value === undefined || moment.isMoment(value)
}

@ -49,7 +49,7 @@ function goDay (direction) {
function isMoment (value) {
if (Array.isArray(value)) {
return value.length === 0 || !!value.find((val) => val === undefined || moment.isMoment(val))
return value.length === 0 || value.findIndex((val) => val === undefined || moment.isMoment(val)) !== -1
} else {
return value === undefined || moment.isMoment(value)
}

@ -11,7 +11,7 @@ import moment from 'moment'
import { setTimeout } from 'timers'
function isMoment (value) {
if (Array.isArray(value)) {
return value.length === 0 || !!value.find((val) => val === undefined || moment.isMoment(val))
return value.length === 0 || value.findIndex((val) => val === undefined || moment.isMoment(val)) !== -1
} else {
return value === undefined || moment.isMoment(value)
}

@ -19,7 +19,7 @@ function getNowByCurrentStateValue (value) {
}
function isMoment (value) {
if (Array.isArray(value)) {
return value.length === 0 || !!value.find((val) => val === undefined || moment.isMoment(val))
return value.length === 0 || value.findIndex((val) => val === undefined || moment.isMoment(val)) !== -1
} else {
return value === undefined || moment.isMoment(value)
}

Loading…
Cancel
Save