From 26277803c6991c948a4e5096f16ba245480dd62e Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 17 Aug 2024 16:21:13 +0200 Subject: [PATCH] Bugfix/fix parse date in date helper (#3675) Handle empty date string --- libs/common/src/lib/helper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index eb0fce202..689150b68 100644 --- a/libs/common/src/lib/helper.ts +++ b/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 if (date?.length === 8) { const match = date.match(/^(\d{4})(\d{2})(\d{2})$/);