mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:38:27 +00:00
Centralize date/time formatting utilities (#11831)
This commit is contained in:
@@ -14,24 +14,6 @@ export function formatImageMatch(matches: boolean): string {
|
||||
return matches ? "✓" : "⚠️ mismatch";
|
||||
}
|
||||
|
||||
export function formatAge(ms: number): string {
|
||||
const seconds = Math.floor(ms / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
|
||||
if (days > 0) {
|
||||
return `${days}d ${hours % 24}h`;
|
||||
}
|
||||
if (hours > 0) {
|
||||
return `${hours}h ${minutes % 60}m`;
|
||||
}
|
||||
if (minutes > 0) {
|
||||
return `${minutes}m`;
|
||||
}
|
||||
return `${seconds}s`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard and counter utilities
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user