Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
let props = this.rule.props;
if ((props.startDate))
$set(props, 'startDate', timeStampToDate(props.startDate));
}
init() {
let props = this.rule.props;
$set(props, 'type', !props.type
? 'date'
: toString(props.type).toLowerCase());
if (isUndef(props.startDate))
$set(props, 'startDate', timeStampToDate(props.startDate));
}
toFormValue(value) {
let parseValue, isArr = Array.isArray(value);
if ('timerange' === this.rule.props.type) {
if (isArr) {
parseValue = value.map((time) => !time ? '' : getTime(timeStampToDate(time)));
} else {
parseValue = ['', ''];
}
} else {
isArr && (value = value[0]);
parseValue = !value ? '' : getTime(timeStampToDate(value));
}
return parseValue;
}
toFormValue(value) {
let isArr = Array.isArray(value), props = this.rule.props, parseValue;
if (['daterange', 'datetimerange'].indexOf(props.type) !== -1) {
if (isArr) {
parseValue = value.map((time) => !time ? '' : timeStampToDate(time));
} else {
parseValue = ['', '']
}
} else if ('date' === props.type && props.multiple === true) {
parseValue = toString(value);
} else {
parseValue = isArr ? (value[0] || '') : value;
parseValue = !parseValue ? '' : timeStampToDate(parseValue);
}
return parseValue;
}
toFormValue(value) {
let parseValue, isArr = Array.isArray(value);
if (this.rule.props.isRange === true) {
if (isArr) {
parseValue = value.map((time) => !time ? '' : toDate(getTime(timeStampToDate(time))));
} else {
parseValue = null;
}
} else {
isArr && (value = value[0]);
parseValue = !value ? null : toDate(getTime(timeStampToDate(value)));
}
return parseValue;
}
parseValue = value.map((time) => !time ? '' : toDate(getTime(timeStampToDate(time))));
} else {
parseValue = value.map((time) => !time ? '' : getTime(timeStampToDate(time)));
} else {
parseValue = value.map((time) => !time ? '' : timeStampToDate(time));
} else {