Browse Source
Bugfix/fix parse date in date helper (#3675)
Handle empty date string
pull/3676/head
Thomas Kaul
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
libs/common/src/lib/helper.ts
|
@ -350,7 +350,11 @@ export function isDerivedCurrency(aCurrency: string) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export function parseDate(date: string): Date | null { |
|
|
export function parseDate(date: string): Date { |
|
|
|
|
|
if (!date) { |
|
|
|
|
|
return undefined; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Transform 'yyyyMMdd' format to supported format by parse function
|
|
|
// Transform 'yyyyMMdd' format to supported format by parse function
|
|
|
if (date?.length === 8) { |
|
|
if (date?.length === 8) { |
|
|
const match = date.match(/^(\d{4})(\d{2})(\d{2})$/); |
|
|
const match = date.match(/^(\d{4})(\d{2})(\d{2})$/); |
|
|