From 4c20759e37e73c098504c9f693f150ade59e0d41 Mon Sep 17 00:00:00 2001 From: jasquat <2487833+jasquat@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:23:56 -0500 Subject: [PATCH] fixes the date picker so it does not change the date after selecting it (#855) * fixes the date picker so it does not change the date after selecting it * Update spiffworkflow-frontend/src/services/DateAndTimeService.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: jasquat Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- spiffworkflow-frontend/src/services/DateAndTimeService.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spiffworkflow-frontend/src/services/DateAndTimeService.tsx b/spiffworkflow-frontend/src/services/DateAndTimeService.tsx index e87f3ae12..8599183f9 100644 --- a/spiffworkflow-frontend/src/services/DateAndTimeService.tsx +++ b/spiffworkflow-frontend/src/services/DateAndTimeService.tsx @@ -41,6 +41,10 @@ const convertDateObjectToFormattedString = (dateObject: Date) => { }; const dateStringToYMDFormat = (dateString: string) => { + // if the date looks like it's already in yyyy-MM--dd format then just return it + if (dateString.match(/^\d{4}-\d{2}-\d{2}$/)) { + return dateString; + } const newDate = parse(dateString, DATE_FORMAT, new Date()); return format(newDate, 'yyyy-MM-dd'); };