mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
(ui): Fix timeAgo helper to return dash when zero time is passed
This commit is contained in:
parent
1601a0861a
commit
14effdde06
@ -64,7 +64,11 @@ export function durationBefore(timestamp: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zeroTimestamp = "0001-01-01T00:00:00Z";
|
||||||
export function timeAgo(timestamp: string): string {
|
export function timeAgo(timestamp: string): string {
|
||||||
|
if (timestamp === zeroTimestamp) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return timeAgoUnix(Date.parse(timestamp) / 1000);
|
return timeAgoUnix(Date.parse(timestamp) / 1000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user