diff --git a/src/components/ui/DateDiffLabel/constant.ts b/src/components/ui/DateDiffLabel/constant.ts index 4edc828..5cc02ba 100644 --- a/src/components/ui/DateDiffLabel/constant.ts +++ b/src/components/ui/DateDiffLabel/constant.ts @@ -1,22 +1,10 @@ export const DATE_DIFF_LABEL = { - second: { - past: '秒前', - }, - minute: { - past: '分前', - }, - hour: { - past: '時間前', - }, - day: { - past: '日前', - }, - week: { - past: '週間前', - }, - month: { - past: 'ヶ月前', - }, + second: '秒前', + minute: '分前', + hour: '時間前', + day: '日前', + week: '週間前', + month: 'ヶ月前', } as const; export const MINUTE = 60; diff --git a/src/components/ui/DateDiffLabel/logic.ts b/src/components/ui/DateDiffLabel/logic.ts index 2af9ce6..e90664f 100644 --- a/src/components/ui/DateDiffLabel/logic.ts +++ b/src/components/ui/DateDiffLabel/logic.ts @@ -18,26 +18,26 @@ export const DateToDiffLabel = ( if(diffInSeconds <= MONTH * 3) { if (diffInSeconds < MINUTE) return `${diffInSeconds}${ - DATE_DIFF_LABEL['second']['past'] + DATE_DIFF_LABEL['second'] }`; if (diffInSeconds < HOUR) return `${Math.floor(diffInSeconds / MINUTE)}${ - DATE_DIFF_LABEL['minute']['past'] + DATE_DIFF_LABEL['minute'] }`; if (diffInSeconds < DAY) return `${Math.floor(diffInSeconds / HOUR)}${ - DATE_DIFF_LABEL['hour']['past'] + DATE_DIFF_LABEL['hour'] }`; if (diffInSeconds < WEEK) return `${Math.floor(diffInSeconds / DAY)}${ - DATE_DIFF_LABEL['day']['past'] + DATE_DIFF_LABEL['day'] }`; if (diffInSeconds < MONTH) return `${Math.floor(diffInSeconds / WEEK)}${ - DATE_DIFF_LABEL['week']['past'] + DATE_DIFF_LABEL['week'] }`; return `${Math.floor(diffInSeconds / MONTH)}${ - DATE_DIFF_LABEL['month']['past'] + DATE_DIFF_LABEL['month'] }`; }