Skip to content

Commit a15c4bc

Browse files
committed
#690: Added the transformDate back
1 parent f4763c2 commit a15c4bc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/frontend/src/pages/WorkPackageForm/WorkPackageFormView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ const WorkPackageFormView: React.FC<WorkPackageFormViewProps> = ({
116116

117117
const { userId } = user;
118118

119+
const transformDate = (date: Date) => {
120+
const month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : (date.getMonth() + 1).toString();
121+
const day = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate().toString();
122+
return new Date(date.getFullYear(), Number(month), Number(day));
123+
};
124+
119125
const onSubmit = async (data: WorkPackageFormViewPayload) => {
120126
const { name, startDate, duration, blockedBy, crId, stage } = data;
121127
const expectedActivities = mapBulletsToPayload(data.expectedActivities);
@@ -129,7 +135,7 @@ const WorkPackageFormView: React.FC<WorkPackageFormViewProps> = ({
129135
userId,
130136
name,
131137
crId: parseInt(crId),
132-
startDate: startDate,
138+
startDate: transformDate(startDate),
133139
duration,
134140
blockedBy: blockedByWbsNums,
135141
expectedActivities: createForm ? expectedActivities.map((activity) => activity.detail) : expectedActivities,

0 commit comments

Comments
 (0)