Show when each Gitea repository was last updated
The API already returned Gitea's updated_at for every repo but the page
never displayed it. The Gitea table now has a sortable "Last updated"
column with a relative age ("3 d ago") over the exact date/time (in the
app's configured date format), and the CSV export includes it.
Gitea only exposes a single updated_at per repository (there is no
separate last-push time), so this is Gitea's own notion of "updated".
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4118062405
commit
017014586f
2 files changed
+31
-2
No files matched your search
@@ -7,3 +7,18 @@ export function formatRemaining(endsAtIso: string, now: number = Date.now()): st
|
||||
const days = Math.floor(hours / 24);
|
||||
return hours % 24 ? `${days} d ${hours % 24} h` : `${days} d`;
|
||||
}
|
||||
|
||||
/** "just now", "5 min ago", "3 h ago", "12 d ago", "5 mo ago", "2 y ago" for an ISO timestamp (a future one reads as "just now"). */
|
||||
export function formatAgo(iso: string, now: number = Date.now()): string {
|
||||
const t = new Date(iso).getTime();
|
||||
if (!Number.isFinite(t)) return "";
|
||||
const minutes = Math.floor(Math.max(0, now - t) / 60_000);
|
||||
if (minutes < 1) return "just now";
|
||||
if (minutes < 60) return `${minutes} min ago`;
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours < 24) return `${hours} h ago`;
|
||||
const days = Math.floor(hours / 24);
|
||||
if (days < 60) return `${days} d ago`;
|
||||
if (days < 730) return `${Math.floor(days / 30)} mo ago`;
|
||||
return `${Math.floor(days / 365)} y ago`;
|
||||
}
|
||||
Reference in new issue
Block a user