Bugfix/fix parse date in date helper (#3675)

Handle empty date string
This commit is contained in:
Thomas Kaul 2024-08-17 16:21:13 +02:00 committed by sudacode
parent 36e987d0f1
commit bb892449ca

View File

@ -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
if (date?.length === 8) {
const match = date.match(/^(\d{4})(\d{2})(\d{2})$/);