This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
|
export function parseDateOrString(rawValue: string | undefined, fallback: unknown) {
|
|
if (typeof rawValue === 'undefined') {
|
|
return fallback
|
|
}
|
|
|
|
const d = new Date(rawValue)
|
|
|
|
return !isNaN(+d)
|
|
? d
|
|
: rawValue
|
|
}
|