From 8c9a4be4aaa32ea8bdc693e7229ab8fc54917ce2 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 14 Jul 2023 11:28:00 -0400 Subject: [PATCH] ensure we convert date ranges to ymd before saving to the task-data w/ burnettk --- spiffworkflow-frontend/src/config.tsx | 3 ++- .../DateRangePicker/DateRangePickerWidget.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spiffworkflow-frontend/src/config.tsx b/spiffworkflow-frontend/src/config.tsx index 0fbb1044..afa18254 100644 --- a/spiffworkflow-frontend/src/config.tsx +++ b/spiffworkflow-frontend/src/config.tsx @@ -83,7 +83,8 @@ export const PROCESS_STATUSES = [ ]; // with time: yyyy-MM-dd HH:mm:ss -let generalDateFormat = 'yyyy-MM-dd'; +// let generalDateFormat = 'yyyy-MM-dd'; +let generalDateFormat = 'dd-MM-yyyy'; if ( 'spiffworkflowFrontendJsenv' in window && 'DATE_FORMAT' in window.spiffworkflowFrontendJsenv diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx index 7401417e..9beb3115 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsx @@ -8,6 +8,7 @@ import { import { convertDateObjectToFormattedString, convertStringToDate, + dateStringToYMDFormat, } from '../../../helpers'; interface widgetArgs { @@ -55,10 +56,12 @@ export default function DateRangePickerWidget({ let dateRangeString; const startDate = convertDateObjectToFormattedString(dateRange[0]); if (startDate) { + const startDateYMD = dateStringToYMDFormat(startDate); const endDate = convertDateObjectToFormattedString(dateRange[1]); - dateRangeString = startDate; + dateRangeString = startDateYMD; if (endDate) { - dateRangeString = `${dateRangeString}${DATE_RANGE_DELIMITER}${endDate}`; + const endDateYMD = dateStringToYMDFormat(endDate); + dateRangeString = `${dateRangeString}${DATE_RANGE_DELIMITER}${endDateYMD}`; } } onChange(dateRangeString);