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 <jasquat@users.noreply.github.com>
Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
jasquat 2024-01-04 10:23:56 -05:00 committed by GitHub
parent 6bafd7b144
commit 4c20759e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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');
};