mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-07 12:42:00 +08:00
Add content to RedisInfoView
This commit is contained in:
@@ -37,13 +37,18 @@ export function durationBefore(timestamp: string): string {
|
||||
|
||||
export function timeAgo(timestamp: string): string {
|
||||
try {
|
||||
const duration = durationBetween(Date.now(), Date.parse(timestamp));
|
||||
return stringifyDuration(duration) + " ago";
|
||||
} catch {
|
||||
return timeAgoUnix(Date.parse(timestamp) / 1000);
|
||||
} catch (error) {
|
||||
console.error("Could not parse timestamp: ", timestamp, error);
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
|
||||
export function timeAgoUnix(unixtime: number) {
|
||||
const duration = durationBetween(Date.now(), unixtime * 1000);
|
||||
return stringifyDuration(duration) + " ago";
|
||||
}
|
||||
|
||||
export function getCurrentUTCDate(): string {
|
||||
const today = new Date();
|
||||
const dd = today.getUTCDate().toString().padStart(2, "0");
|
||||
|
Reference in New Issue
Block a user