Skip to content

Commit

Permalink
chore: delete past key
Browse files Browse the repository at this point in the history
  • Loading branch information
yamato0211 committed Nov 16, 2023
1 parent 9d7d8ba commit d0a84a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
24 changes: 6 additions & 18 deletions src/components/ui/DateDiffLabel/constant.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/components/ui/DateDiffLabel/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
}`;
}

Expand Down

0 comments on commit d0a84a4

Please sign in to comment.