1
0

fix(filter): don't prevent entering date math strings

Resolves https://community.vikunja.io/t/filter-setting-s/1791/2
This commit is contained in:
kolaente
2023-11-17 19:38:55 +01:00
parent 7f279c98e1
commit aa5e11915e
2 changed files with 10 additions and 5 deletions

View File

@ -1,8 +1,12 @@
export function parseDateOrString(rawValue: string | undefined, fallback: unknown) {
if (typeof rawValue === 'undefined') {
export function parseDateOrString(rawValue: string | undefined | null, fallback: unknown): (unknown | string | Date) {
if (rawValue === null || typeof rawValue === 'undefined') {
return fallback
}
if (rawValue.toLowerCase().includes('now') || rawValue.toLowerCase().includes('||')) {
return rawValue
}
const d = new Date(rawValue)
return !isNaN(+d)