From da95c32a0dbbb85b56576a177ad2efb72c078fd9 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Tue, 10 Sep 2024 16:52:12 +0200 Subject: [PATCH] fix(SW-360): Solved issue with date field not using placeholder values --- components/TempDesignSystem/Form/Date/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/TempDesignSystem/Form/Date/index.tsx b/components/TempDesignSystem/Form/Date/index.tsx index 25caf72f3..7b9dbc083 100644 --- a/components/TempDesignSystem/Form/Date/index.tsx +++ b/components/TempDesignSystem/Form/Date/index.tsx @@ -60,7 +60,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { * date, but we can't check isNan since * we recieve the date as "1999-01-01" */ - dateValue = parseDate(d) + dateValue = d ? parseDate(d) : null } catch (error) { console.error(error) } @@ -100,7 +100,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { placeholder="DD" required tabIndex={3} - value={segment.value} + value={segment.isPlaceholder ? undefined : segment.value} /> ) @@ -116,7 +116,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { placeholder="MM" required tabIndex={2} - value={segment.value} + value={segment.isPlaceholder ? undefined : segment.value} /> ) @@ -132,7 +132,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) { placeholder="YYYY" required tabIndex={1} - value={segment.value} + value={segment.isPlaceholder ? undefined : segment.value} /> )