mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-02-23 20:30:12 +08:00
Update timeAgo helper to handle zero unix time
This commit is contained in:
parent
565dfb4ccf
commit
b5de7e6994
@ -68,7 +68,10 @@ export function timeAgo(timestamp: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function timeAgoUnix(unixtime: number) {
|
export function timeAgoUnix(unixtime: number): string {
|
||||||
|
if (unixtime === 0) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
const duration = durationBetween(Date.now(), unixtime * 1000);
|
const duration = durationBetween(Date.now(), unixtime * 1000);
|
||||||
return stringifyDuration(duration) + " ago";
|
return stringifyDuration(duration) + " ago";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user