
support async component, see: https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
12 lines
218 B
TypeScript
12 lines
218 B
TypeScript
export function parseDateOrString(rawValue: string | undefined, fallback: unknown) {
|
|
if (typeof rawValue === 'undefined') {
|
|
return fallback
|
|
}
|
|
|
|
const d = new Date(rawValue)
|
|
|
|
return !isNaN(+d)
|
|
? d
|
|
: rawValue
|
|
}
|