Skip to content

Commit

Permalink
feat: 방 생성 시 모집마감일에 따라 코드리뷰마감일의 선택일이 제한되도록 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pp449 committed Nov 11, 2024
1 parent 538c9e3 commit 635ab07
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions frontend/src/components/roomForm/RoomFormLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,17 @@ const RoomFormLayout = ({ formType, roomId, data }: RoomFormLayoutProps) => {
<S.ContentInput>
<DateTimePicker
selectedDateTime={formState.recruitmentDeadline}
onDateTimeChange={(newDateTime) =>
handleInputChange("recruitmentDeadline", newDateTime)
}
onDateTimeChange={(newDateTime) => {
handleInputChange("recruitmentDeadline", newDateTime);
if (newDateTime > formState.reviewDeadline) {
const newDate = new Date();
newDate.setFullYear(newDateTime.getFullYear());
newDate.setMonth(newDateTime.getMonth());
newDate.setDate(newDateTime.getDate());
handleInputChange("reviewDeadline", newDate);
}
}}
options={{ isPastDateDisabled: true }}
/>
</S.ContentInput>
</S.RowContainer>
Expand All @@ -233,6 +241,10 @@ const RoomFormLayout = ({ formType, roomId, data }: RoomFormLayoutProps) => {
<DateTimePicker
selectedDateTime={formState.reviewDeadline}
onDateTimeChange={(newDateTime) => handleInputChange("reviewDeadline", newDateTime)}
options={{
isPastDateDisabled: true,
disabledBeforeDate: formState.recruitmentDeadline,
}}
/>
</S.ContentInput>
</S.RowContainer>
Expand Down

0 comments on commit 635ab07

Please sign in to comment.