diff --git a/src/app/(sidebar)/(my-info)/components/InfoCardItem.tsx b/src/app/(sidebar)/(my-info)/components/InfoCardItem.tsx index a27b2aa2..d5a2c70b 100644 --- a/src/app/(sidebar)/(my-info)/components/InfoCardItem.tsx +++ b/src/app/(sidebar)/(my-info)/components/InfoCardItem.tsx @@ -17,7 +17,7 @@ const TAG_TYPE_COLOR = { } as const; export function InfoCardItem({ title, updatedDate, cardTagList }: Props) { - const formattedDate = formatToYYMMDD(updatedDate); + const formattedDate = formatToYYMMDD(updatedDate, '.'); return (
diff --git a/src/utils/date.ts b/src/utils/date.ts index 7d2700b9..6702d31c 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -1,9 +1,9 @@ -export const formatToYYMMDD = (dateString: string) => { +export const formatToYYMMDD = (dateString: string, separator: string = '') => { const date = new Date(dateString); const yy = String(date.getFullYear()).slice(-2); const mm = String(date.getMonth() + 1).padStart(2, '0'); const dd = String(date.getDate()).padStart(2, '0'); - return `${yy}.${mm}.${dd}`; + return [yy, mm, dd].join(separator); };