Remove validator function (because:)
We have too many use cases and we cannot access props inside validator function, so we cannot do proper checking anyway
This commit is contained in:
parent
4a1734b77e
commit
8878e4a351
1 changed files with 1 additions and 21 deletions
|
@ -154,27 +154,7 @@
|
|||
default: () => []
|
||||
},
|
||||
value: {
|
||||
type: [Date, String, Array],
|
||||
validator(val){
|
||||
if (Array.isArray(val)){
|
||||
// check if its empty values
|
||||
if (isEmptyArray(val)) return true;
|
||||
|
||||
// check if is time format
|
||||
if (val[0].match(/^[\d:]+$/) && val[1].match(/^[\d:]+$/)) return true;
|
||||
|
||||
// check if its valid value
|
||||
const [start, end] = val.map(v => new Date(v));
|
||||
return !isNaN(start.getTime()) && !isNaN(end.getTime());
|
||||
} else {
|
||||
if (typeof val === 'string') {
|
||||
val = val.trim();
|
||||
if (val.match(/^[\d:]+$/)) return true; // time format
|
||||
}
|
||||
const date = new Date(val);
|
||||
return val === '' || val === null || !isNaN(date.getTime());
|
||||
}
|
||||
}
|
||||
type: [Date, String, Array]
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
|
|
Loading…
Add table
Reference in a new issue