Skip to content

Commit 5eaad35

Browse files
committed
refactor: 슬로건 기간 상수 공통화 적용
1 parent a16b34a commit 5eaad35

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • src/widgets/main/SloganSecondSection

src/widgets/main/SloganSecondSection/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import Button from "@/shared/ui/Button";
66
import { cn } from "@/shared/utils/cn";
77
import { SectionTitle } from "@/shared/ui/SectionTitle";
88
import { formatDate } from "@/shared/utils/formatDate";
9+
import { sloganStartDate, sloganEndDate } from "@/shared/config/authConfig";
910

10-
const SLOGAN_YEAR = 2026;
11-
12-
const SLOGAN_START = new Date(`${SLOGAN_YEAR}-05-18T00:00:00+09:00`);
13-
const SLOGAN_END = new Date(`${SLOGAN_YEAR}-05-28T23:59:59+09:00`);
11+
const SLOGAN_YEAR = sloganStartDate.getFullYear();
1412

1513
const SloganSecondSection = () => {
1614
const router = useRouter();
@@ -20,7 +18,7 @@ const SloganSecondSection = () => {
2018
React.useEffect(() => {
2119
const checkPeriod = () => {
2220
const now = new Date();
23-
setIsSloganPeriod(now >= SLOGAN_START && now <= SLOGAN_END);
21+
setIsSloganPeriod(now >= sloganStartDate && now <= sloganEndDate);
2422
};
2523

2624
checkPeriod();
@@ -30,8 +28,8 @@ const SloganSecondSection = () => {
3028
}, []);
3129

3230
const submissionPeriodText = React.useMemo(() => {
33-
const startText = formatDate(SLOGAN_START);
34-
const endText = formatDate(SLOGAN_END);
31+
const startText = formatDate(sloganStartDate);
32+
const endText = formatDate(sloganEndDate);
3533
return `공모기간 : ${SLOGAN_YEAR}.${startText}~${endText} 24:00까지`;
3634
}, []);
3735

0 commit comments

Comments
 (0)