mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-16 20:35:27 +08:00
Update timeAgo helper to handle zero unix time
This commit is contained in:
@@ -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";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user