Skip to content

Commit

Permalink
fix(#208): api 응답으로 온 시간과 파싱한 시간이 안 맞는 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
naarang committed Dec 5, 2024
1 parent 8519406 commit 0d290a9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/frontend/src/shared/common/component/Time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { Slot, SlotComponentProps } from '@froxy/design/components';
import { cn } from '@froxy/design/utils';

export const formatDate = {
day: (date: Date, locales: Intl.LocalesArgument) => date.toLocaleDateString(locales, { weekday: 'long' }),
'YYYY.MM.DD.': (date: Date, locales: Intl.LocalesArgument) => date.toLocaleDateString(locales).split('T')[0],
day: (date: Date, locales: Intl.LocalesArgument) =>
date.toLocaleDateString(locales, { weekday: 'long', timeZone: 'UCT' }),
'YYYY.MM.DD.': (date: Date, locales: Intl.LocalesArgument) =>
date.toLocaleDateString(locales, { timeZone: 'UTC' }).split('T')[0],
'YYYY-MM-DD': (date: Date, locales: Intl.LocalesArgument) =>
date.toLocaleDateString(locales).slice(0, 11).replaceAll('. ', '-')
date.toLocaleDateString(locales, { timeZone: 'UTC' }).replaceAll('.', '-').slice(0, 11).replaceAll(' ', '')
} as const;

export type FormatDateKey = keyof typeof formatDate;
Expand Down

0 comments on commit 0d290a9

Please sign in to comment.