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:
parent
6bafd7b144
commit
4c20759e37
|
@ -41,6 +41,10 @@ const convertDateObjectToFormattedString = (dateObject: Date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateStringToYMDFormat = (dateString: string) => {
|
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());
|
const newDate = parse(dateString, DATE_FORMAT, new Date());
|
||||||
return format(newDate, 'yyyy-MM-dd');
|
return format(newDate, 'yyyy-MM-dd');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue