From 538c9e3f7999093491b8f1f6846876a3e904d7d4 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Mon, 11 Nov 2024 11:55:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=A7=80=EC=A0=95=EB=90=9C=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C(=EB=98=90=EB=8A=94=20=EC=98=A4=EB=8A=98)=20?= =?UTF-8?q?=EC=A0=84=EB=82=A0=EA=B9=8C=EC=A7=80=20=EC=BA=98=EB=A6=B0?= =?UTF-8?q?=EB=8D=94=EC=97=90=EC=84=9C=20=EC=84=A0=ED=83=9D=EC=9D=B4=20?= =?UTF-8?q?=EC=95=88=EB=90=98=EB=8F=84=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/common/calendar/Calendar.tsx | 7 ++++--- .../src/components/dateTimePicker/DateTimePicker.tsx | 12 ++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/common/calendar/Calendar.tsx b/frontend/src/components/common/calendar/Calendar.tsx index a9450181c..5edec46e6 100644 --- a/frontend/src/components/common/calendar/Calendar.tsx +++ b/frontend/src/components/common/calendar/Calendar.tsx @@ -8,6 +8,7 @@ export interface CalendarProps { selectedDate: Date; handleSelectedDate: (newSelectedDate: Date) => void; options?: { + disabledBeforeDate?: Date; isPastDateDisabled: boolean; }; } @@ -35,12 +36,12 @@ const Calendar = ({ selectedDate, handleSelectedDate, options }: CalendarProps) const checkIsAvailableClick = (day: number) => { if (!options?.isPastDateDisabled) return true; - const today = new Date(); - today.setHours(0, 0, 0, 0); + const targetDate = options.disabledBeforeDate || new Date(); + targetDate.setHours(0, 0, 0, 0); const checkingDate = new Date(currentViewYear, currentViewMonth - 1, day); - return today <= checkingDate; + return targetDate <= checkingDate; }; return ( diff --git a/frontend/src/components/dateTimePicker/DateTimePicker.tsx b/frontend/src/components/dateTimePicker/DateTimePicker.tsx index 0d9f15f9f..690e054ba 100644 --- a/frontend/src/components/dateTimePicker/DateTimePicker.tsx +++ b/frontend/src/components/dateTimePicker/DateTimePicker.tsx @@ -4,9 +4,13 @@ import { TimeDropdown } from "@/components/common/timeDropdown/TimeDropdown"; interface DateTimePickerProps { selectedDateTime: Date; onDateTimeChange: (dateTime: Date) => void; + options: { + disabledBeforeDate?: Date; + isPastDateDisabled: boolean; + }; } -const DateTimePicker = ({ selectedDateTime, onDateTimeChange }: DateTimePickerProps) => { +const DateTimePicker = ({ selectedDateTime, options, onDateTimeChange }: DateTimePickerProps) => { const handleDateChange = (newDate: Date) => { const updatedDateTime = new Date(newDate); updatedDateTime.setHours(selectedDateTime.getHours()); @@ -23,7 +27,11 @@ const DateTimePicker = ({ selectedDateTime, onDateTimeChange }: DateTimePickerPr return ( <> - + ); From 635ab072d2f9d5a0af5593b9fbf0a4d83b0e4368 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Mon, 11 Nov 2024 11:56:38 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EB=B0=A9=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=8B=9C=20=EB=AA=A8=EC=A7=91=EB=A7=88=EA=B0=90=EC=9D=BC?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=EB=A7=88=EA=B0=90=EC=9D=BC=EC=9D=98=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=EC=9D=BC=EC=9D=B4=20=EC=A0=9C=ED=95=9C=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/roomForm/RoomFormLayout.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/roomForm/RoomFormLayout.tsx b/frontend/src/components/roomForm/RoomFormLayout.tsx index 1f0b1a554..65e7b9f72 100644 --- a/frontend/src/components/roomForm/RoomFormLayout.tsx +++ b/frontend/src/components/roomForm/RoomFormLayout.tsx @@ -218,9 +218,17 @@ const RoomFormLayout = ({ formType, roomId, data }: RoomFormLayoutProps) => { - 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 }} /> @@ -233,6 +241,10 @@ const RoomFormLayout = ({ formType, roomId, data }: RoomFormLayoutProps) => { handleInputChange("reviewDeadline", newDateTime)} + options={{ + isPastDateDisabled: true, + disabledBeforeDate: formState.recruitmentDeadline, + }} />