Skip to content

Commit

Permalink
fix(utils): safe guard of relativeTime
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Oct 15, 2022
1 parent 83febb3 commit 3e11019
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export const relativeTimeFromNow = (
time: Date | string,
current = new Date(),
) => {
if (!time) {
return ''
}
time = new Date(time)
const msPerMinute = 60 * 1000
const msPerHour = msPerMinute * 60
Expand Down

0 comments on commit 3e11019

Please sign in to comment.