diff --git a/backend/src/routes/schedules/index.js b/backend/src/routes/schedules/index.js index 7af35e1..36fa758 100644 --- a/backend/src/routes/schedules/index.js +++ b/backend/src/routes/schedules/index.js @@ -327,6 +327,11 @@ async function handleMonthlySchedules(db, year, month) { // 생일 일정 추가 for (const member of birthdays) { const birthDate = new Date(member.birth_date); + const birthYear = birthDate.getFullYear(); + + // 조회 연도가 생년보다 이전이면 스킵 + if (year < birthYear) continue; + const birthdayThisYear = new Date(year, birthDate.getMonth(), birthDate.getDate()); const dateKey = birthdayThisYear.toISOString().split('T')[0]; diff --git a/frontend/src/components/admin/CustomDatePicker.jsx b/frontend/src/components/admin/CustomDatePicker.jsx index 98abb0c..e4524b7 100644 --- a/frontend/src/components/admin/CustomDatePicker.jsx +++ b/frontend/src/components/admin/CustomDatePicker.jsx @@ -40,13 +40,15 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show days.push(i); } - const startYear = Math.floor(year / 10) * 10 - 1; + const MIN_YEAR = 2025; + const startYear = Math.max(MIN_YEAR, Math.floor(year / 12) * 12 - 1); const years = Array.from({ length: 12 }, (_, i) => startYear + i); + const canGoPrevYearRange = startYear > MIN_YEAR; const prevMonth = () => setViewDate(new Date(year, month - 1, 1)); const nextMonth = () => setViewDate(new Date(year, month + 1, 1)); - const prevYearRange = () => setViewDate(new Date(year - 10, month, 1)); - const nextYearRange = () => setViewDate(new Date(year + 10, month, 1)); + const prevYearRange = () => canGoPrevYearRange && setViewDate(new Date(Math.max(MIN_YEAR, year - 12), month, 1)); + const nextYearRange = () => setViewDate(new Date(year + 12, month, 1)); const selectDate = (day) => { const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; @@ -57,7 +59,6 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show const selectYear = (y) => { setViewDate(new Date(y, month, 1)); - setViewMode('months'); }; const selectMonth = (m) => { @@ -124,7 +125,8 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show diff --git a/frontend/src/pages/mobile/public/Schedule.jsx b/frontend/src/pages/mobile/public/Schedule.jsx index fc55c09..09e9d3c 100644 --- a/frontend/src/pages/mobile/public/Schedule.jsx +++ b/frontend/src/pages/mobile/public/Schedule.jsx @@ -1239,8 +1239,10 @@ function CalendarPicker({ } }; - const [yearRangeStart, setYearRangeStart] = useState(Math.floor(year / 12) * 12); + const MIN_YEAR = 2025; + const [yearRangeStart, setYearRangeStart] = useState(MIN_YEAR); const yearRange = Array.from({ length: 12 }, (_, i) => yearRangeStart + i); + const canGoPrevYearRange = yearRangeStart > MIN_YEAR; // 배경 스크롤 막기 useEffect(() => { @@ -1364,16 +1366,17 @@ function CalendarPicker({ > {/* 년도 범위 헤더 */}
- {yearRangeStart} - {yearRangeStart + 11} - diff --git a/frontend/src/pages/pc/admin/AdminScheduleDict.jsx b/frontend/src/pages/pc/admin/AdminScheduleDict.jsx index 5338ea9..19e9242 100644 --- a/frontend/src/pages/pc/admin/AdminScheduleDict.jsx +++ b/frontend/src/pages/pc/admin/AdminScheduleDict.jsx @@ -613,7 +613,7 @@ function AdminScheduleDict() { ) : (
- + diff --git a/frontend/src/pages/pc/admin/schedule/form/index.jsx b/frontend/src/pages/pc/admin/schedule/form/index.jsx index 133fa5f..07bd1b4 100644 --- a/frontend/src/pages/pc/admin/schedule/form/index.jsx +++ b/frontend/src/pages/pc/admin/schedule/form/index.jsx @@ -34,7 +34,7 @@ const formVariants = { visible: { opacity: 1, y: 0, - transition: { duration: 0.3, ease: "easeOut" }, + transition: { duration: 0.3, ease: "easeOut", delay: 0.3 }, }, exit: { opacity: 0, diff --git a/frontend/src/pages/pc/public/Schedule.jsx b/frontend/src/pages/pc/public/Schedule.jsx index 3247360..30ccfa4 100644 --- a/frontend/src/pages/pc/public/Schedule.jsx +++ b/frontend/src/pages/pc/public/Schedule.jsx @@ -431,7 +431,6 @@ function Schedule() { const selectYear = (newYear) => { setCurrentDate(new Date(newYear, month, 1)); - setViewMode('months'); }; const selectMonth = (newMonth) => { @@ -568,12 +567,14 @@ function Schedule() { return year === now.getFullYear() && m === now.getMonth(); }; - // 연도 선택 범위 - const [yearRangeStart, setYearRangeStart] = useState(currentYear - 1); + // 연도 선택 범위 (2025년부터 시작) + const MIN_YEAR = 2025; + const [yearRangeStart, setYearRangeStart] = useState(MIN_YEAR); const yearRange = Array.from({ length: 12 }, (_, i) => yearRangeStart + i); const monthNames = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']; - const prevYearRange = () => setYearRangeStart(prev => prev - 3); - const nextYearRange = () => setYearRangeStart(prev => prev + 3); + const canGoPrevYearRange = yearRangeStart > MIN_YEAR; + const prevYearRange = () => canGoPrevYearRange && setYearRangeStart(prev => Math.max(MIN_YEAR, prev - 12)); + const nextYearRange = () => setYearRangeStart(prev => prev + 12); // 선택된 카테고리 이름 const getSelectedCategoryNames = () => { @@ -680,7 +681,7 @@ function Schedule() { className="absolute top-20 left-8 right-8 mx-auto w-80 bg-white rounded-xl shadow-lg border border-gray-200 p-4 z-10" >
-
# 단어