Skip to content

Commit 0bfed83

Browse files
committed
fix(planner) : 생성 시 오늘 날짜가 공연 시작일일 때 에러 처리
1 parent 186c78e commit 0bfed83

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/components/concert/detail/ConcertHeaderBtn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default function ConcertHeaderBtn({
9696
// 공연 당일 확인
9797
const concertStart = getConcertStartDate(concertDetail.startDate);
9898
if (isSameDay(plannerDate, concertStart)) {
99-
toast.error("공연 당일은 플래너를 생성할 수 없습니다.");
99+
toast.error("오늘은 공연 시작일이므로 플래너를 생성할 수 없습니다.");
100100
return;
101101
}
102102

src/components/concert/detail/QuickActionsSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default function QuickActionsSection({
126126
// 공연 당일 확인
127127
const concertStart = getConcertStartDate(concertStartDate!);
128128
if (isSameDay(plannerDate, concertStart)) {
129-
toast.error("공연 당일은 플래너를 생성할 수 없습니다.");
129+
toast.error("오늘은 공연 시작일이므로 플래너를 생성할 수 없습니다.");
130130
return;
131131
}
132132

src/components/planner/PlannerCreate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export default function PlannerCreate() {
159159
// 공연 당일 확인
160160
const concertStart = getConcertStartDate(concertDetail?.startDate || "");
161161
if (isSameDay(plannerDate, concertStart)) {
162-
toast.error("공연 당일은 플래너를 생성할 수 없습니다.");
162+
toast.error("오늘은 공연 시작일이므로 플래너를 생성할 수 없습니다.");
163163
return;
164164
}
165165

src/utils/helpers/handleDate.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// 날짜 비교 유틸 함수
22
export const isSameDay = (date1: Date, date2: Date) => {
3+
// 한국 시간(KST)으로 오늘 날짜 가져오기
4+
const todayKST = new Date(new Date().toLocaleString("en-US", { timeZone: "Asia/Seoul" }));
5+
36
return (
47
date1.getFullYear() === date2.getFullYear() &&
58
date1.getMonth() === date2.getMonth() &&
6-
date1.getDate() === date2.getDate()
9+
date1.getDate() === date2.getDate() &&
10+
date1.getFullYear() === todayKST.getFullYear() &&
11+
date1.getMonth() === todayKST.getMonth() &&
12+
date1.getDate() === todayKST.getDate()
713
);
814
};
915

0 commit comments

Comments
 (0)