From 556745f78856cbdcf33795a3237f0251922b8f5f Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 1 May 2024 02:53:09 +0900 Subject: [PATCH] refactoring: data formatting export --- frontend/src/utils/dateUtils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/utils/dateUtils.js b/frontend/src/utils/dateUtils.js index 43da7a5..93bea3c 100644 --- a/frontend/src/utils/dateUtils.js +++ b/frontend/src/utils/dateUtils.js @@ -10,3 +10,13 @@ export const formatHoliday = (date) => { const month = `0${date.getMonth() + 1}`.slice(-2) return { year, month } } + +export const formatDate = (date) => { + const weekDays = ['일', '월', '화', '수', '목', '금', '토'] + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const weekDay = weekDays[date.getDay()] + + return `${year}년 ${month}월 ${day}일 (${weekDay})` +}