diff --git a/client/src/modules/CourseManagement/components/CourseEventModal/formState.ts b/client/src/modules/CourseManagement/components/CourseEventModal/formState.ts index fe0d1163b0..39ef31bbc8 100644 --- a/client/src/modules/CourseManagement/components/CourseEventModal/formState.ts +++ b/client/src/modules/CourseManagement/components/CourseEventModal/formState.ts @@ -83,8 +83,9 @@ export function getInitialValues(modalData: Partial) { type: EVENT_TYPES.find(event => event.id === modalData.event?.type)?.id ?? null, descriptionUrl: modalData.event?.descriptionUrl ? modalData.event.descriptionUrl : '', description: modalData.event?.description ? modalData.event.description : '', - dateTime: modalData.dateTime ? dayjs.utc(modalData.dateTime) : null, - endTime: modalData.endTime ? dayjs.utc(modalData.endTime) : null, + //need to refactor + dateTime: dayjs.utc(modalData.dateTime ?? undefined), + endTime: dayjs.utc(modalData.endTime ?? undefined), organizerId: modalData.organizer ? modalData.organizer.id : undefined, special: modalData.special ? modalData.special.split(',') : [], timeZone, diff --git a/client/src/modules/CourseManagement/components/CourseTaskModal/index.tsx b/client/src/modules/CourseManagement/components/CourseTaskModal/index.tsx index 723177ae02..8059778e5a 100644 --- a/client/src/modules/CourseManagement/components/CourseTaskModal/index.tsx +++ b/client/src/modules/CourseManagement/components/CourseTaskModal/index.tsx @@ -135,9 +135,7 @@ export function CourseTaskModal(props: Props) { label="Start Date - End Date" rules={[{ required: true, type: 'array', message: 'Please enter start and end date' }]} > - + @@ -216,7 +214,7 @@ function createRecord(values: any): CreateCourseTaskDto { const data = { studentStartDate: startDate.utc().format(), studentEndDate: endDate.utc().format(), - crossCheckEndDate: crossCheckEndDate ? crossCheckEndDate.utc().hour(23).minute(59).format() : undefined, + crossCheckEndDate: crossCheckEndDate ? crossCheckEndDate.utc().hour(23).minute(59).second(59).format() : undefined, taskId: values.taskId, taskOwnerId: values.taskOwner?.id, checker: values.checker, @@ -244,7 +242,7 @@ function getInitialValues(modalData: Partial) { modalData.studentStartDate ? dayjs.utc(modalData.studentStartDate) : null, modalData.studentEndDate ? dayjs.utc(modalData.studentEndDate) : null, ] - : null, + : [dayjs().utc().hour(0).minute(0).second(0), dayjs().utc().hour(23).minute(59).second(58)], checker: modalData.checker || CreateCourseTaskDtoCheckerEnum.AutoTest, }; return data;