From 89a6bc20972747b5a33a0184aa98837a8e691db3 Mon Sep 17 00:00:00 2001 From: keemsebeen Date: Sat, 12 Oct 2024 02:09:46 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20Date=20YYYY.=20MM.=20DD=20=ED=98=95?= =?UTF-8?q?=EC=8B=9D=EC=97=90=20=EB=A7=9E=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/features/MeetingDetail/MeetingInfo.tsx | 3 ++- src/utils/formatDate.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/utils/formatDate.ts diff --git a/src/components/features/MeetingDetail/MeetingInfo.tsx b/src/components/features/MeetingDetail/MeetingInfo.tsx index 349db85..5448c00 100644 --- a/src/components/features/MeetingDetail/MeetingInfo.tsx +++ b/src/components/features/MeetingDetail/MeetingInfo.tsx @@ -4,6 +4,7 @@ import { queries } from '@/apis'; import { Chip } from '@/components/common/Chip'; import { FlexBox } from '@/components/common/FlexBox'; import { SpeechBubble } from '@/components/common/SpeechBubble'; +import { formatDate } from '@/utils/formatDate'; import { isPastDate } from '@/utils/isPastDate'; import { UuidProps } from './MeetingDetail.type'; @@ -24,7 +25,7 @@ export const MeetingInfo = ({ uuid }: UuidProps) => { {meetingData.meetingName} - {meetingData.meetingStartDate} - {meetingData.meetingEndDate} + {formatDate(meetingData.meetingStartDate)} - {formatDate(meetingData.meetingEndDate)} {/* TODO : 길이가 길어지는 경우 flex 조절 필요 */} diff --git a/src/utils/formatDate.ts b/src/utils/formatDate.ts new file mode 100644 index 0000000..09999b7 --- /dev/null +++ b/src/utils/formatDate.ts @@ -0,0 +1,7 @@ +import dayjs from 'dayjs'; + +export const formatDate = (dateString: string): string => { + const date = dayjs(dateString); + + return date.format('YYYY. MM. DD'); +};