feat: add date range filter to task filters
This commit is contained in:
12
src/helpers/time/parseDateOrString.ts
Normal file
12
src/helpers/time/parseDateOrString.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export function parseDateOrString(rawValue: string, fallback: any) {
|
||||
if (typeof rawValue === 'undefined') {
|
||||
return fallback
|
||||
}
|
||||
|
||||
const d = new Date(rawValue)
|
||||
|
||||
// @ts-ignore if rawValue is an invalid date, isNan will return false.
|
||||
return !isNaN(d)
|
||||
? d
|
||||
: rawValue
|
||||
}
|
Reference in New Issue
Block a user