From bf38c7ec127cb025561586ea71b43e6105a1f1c1 Mon Sep 17 00:00:00 2001 From: "misung.dev" Date: Tue, 17 Sep 2024 16:27:43 +0900 Subject: [PATCH 1/3] =?UTF-8?q?#297=20fix:=20=EC=98=A4=EB=A5=98=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DashboardInfoPage/DashboardInfoPage.jsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx b/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx index 6c42a03..e0acd0c 100644 --- a/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx +++ b/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx @@ -49,7 +49,7 @@ export default function DashboardInfoPage() { isError, } = useQuery({ queryKey: ['getEventDetail', eventId], - queryFn: () => getEventDetail(USER_ID, eventId), + queryFn: () => getEventDetail(eventId), }); const { @@ -81,16 +81,25 @@ export default function DashboardInfoPage() { eventSchedules, } = eventDetail; + const parseDateTime = (date, time) => { + const parsedTime = Date.parse(`${date}T${time}`); + if (isNaN(parsedTime)) { + console.error(`Invalid time value: ${date}T${time}`); + return new Date(); + } + return new Date(`${date}T${time}`); + }; + setEventType(eventType); setEventTarget(eventTarget); setEventTitle(eventTitle); setEventDescription(eventDescription); setEventImage(eventImage || ''); setEventSchedules( - eventSchedules.map(({ eventDate, eventStartTime, eventEndTime }) => ({ + eventSchedules.map(({ eventDate, startTime, endTime }) => ({ eventDate: new Date(eventDate), - eventStartTime: new Date(`${eventDate}T${eventStartTime}`), - eventEndTime: new Date(`${eventDate}T${eventEndTime}`), + eventStartTime: parseDateTime(eventDate, startTime), + eventEndTime: parseDateTime(eventDate, endTime), })), ); @@ -101,10 +110,10 @@ export default function DashboardInfoPage() { eventDescription, eventImage: eventImage || '', eventSchedules: eventSchedules.map( - ({ eventDate, eventStartTime, eventEndTime }) => ({ + ({ eventDate, startTime, endTime }) => ({ eventDate: new Date(eventDate), - eventStartTime: new Date(`${eventDate}T${eventStartTime}`), - eventEndTime: new Date(`${eventDate}T${eventEndTime}`), + eventStartTime: parseDateTime(eventDate, startTime), + eventEndTime: parseDateTime(eventDate, endTime), }), ), }; @@ -256,9 +265,9 @@ export default function DashboardInfoPage() { onStartTimeChange={handleStartTimeChange} onEndTimeChange={handleEndTimeChange} onDelete={handleDeleteSchedule} - onAddSchedule={handleAddSchedule} // 일정 추가 함수 전달 + onAddSchedule={handleAddSchedule} isDeletable={index !== 0} - isLastItem={index === eventSchedules.length - 1} // 마지막 항목인지 확인 + isLastItem={index === eventSchedules.length - 1} /> ))} From 4d0c4cf3dc00dbdad47da67000c01c7021c5f2df Mon Sep 17 00:00:00 2001 From: "misung.dev" Date: Tue, 17 Sep 2024 16:36:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?#297=20feat:=20=EC=88=98=EC=A0=95=EC=82=AC?= =?UTF-8?q?=ED=95=AD=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=ED=95=98=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=EB=90=98=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx b/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx index e0acd0c..7f75e03 100644 --- a/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx +++ b/src/pages/DashboardPage/DashboardInfoPage/DashboardInfoPage.jsx @@ -60,7 +60,7 @@ export default function DashboardInfoPage() { mutationFn: (body) => updateEventDetail(USER_ID, eventId, body), onSuccess: () => { alert('행사 정보가 성공적으로 저장되었습니다.'); - setIsChanged(false); + setIsChanged(false); // 저장 후 변경 사항을 초기화 }, onError: () => { alert('행사 정보를 저장하는 데 실패했습니다. 다시 시도해 주세요.'); @@ -238,6 +238,10 @@ export default function DashboardInfoPage() {