Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: date picker bug #2341

Merged
merged 2 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export function getInitialValues(modalData: Partial<CourseEvent>) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' }]}
>
<DatePicker.RangePicker
showTime={{ format: 'HH:mm', defaultValue: [dayjs().hour(0).minute(0), dayjs().hour(23).minute(59)] }}
/>
<DatePicker.RangePicker showTime={{ format: 'HH:mm' }} />
</Form.Item>
</Col>
<Col span={6}>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -244,7 +242,7 @@ function getInitialValues(modalData: Partial<CourseTaskDetails>) {
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;
Expand Down