From ead90b130734a160e1bc36d9e1924222d9b723c4 Mon Sep 17 00:00:00 2001 From: Chris Phillipson Date: Tue, 28 Jul 2026 21:50:09 -0700 Subject: [PATCH] fix: cascade dashboard relative-time labels beyond hours The Live Sessions project list showed raw hour counts (e.g. "999h ago") with no upper bound. Roll over into days past 24h, weeks past 7d, and years past 52w so long-idle projects read as "41d 15h ago" instead. --- src/lib/dashboard/live/client.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dashboard/live/client.mjs b/src/lib/dashboard/live/client.mjs index 1c2f8af..16261d5 100644 --- a/src/lib/dashboard/live/client.mjs +++ b/src/lib/dashboard/live/client.mjs @@ -24,7 +24,7 @@ export const LIVE_JS = ` function esc(s){return String(s==null?"":s).replace(/[&<>"']/g,function(c){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[c];});} function short(s,n){s=String(s||"");return s.length>n?s.slice(0,n-1)+"…":s;} function title(s){return String(s||"activity").replace(/[._-]+/g," ").replace(/\\b\\w/g,function(c){return c.toUpperCase();});} - function ago(v){var at=Date.parse(v||""),ms=Date.now()-at;if(!Number.isFinite(ms))return"";var s=Math.max(0,Math.round(ms/1000));if(s<5)return"just now";if(s<60)return s+"s ago";var m=Math.round(s/60);return m<60?m+"m ago":Math.round(m/60)+"h ago";} + function ago(v){var at=Date.parse(v||""),ms=Date.now()-at;if(!Number.isFinite(ms))return"";var s=Math.max(0,Math.round(ms/1000));if(s<5)return"just now";if(s<60)return s+"s ago";var m=Math.round(s/60);if(m<60)return m+"m ago";var h=Math.round(m/60);if(h<24)return h+"h ago";var d=Math.floor(h/24),rh=h%24;if(d<7)return d+"d "+rh+"h ago";var w=Math.floor(d/7),rd=d%7;if(w<52)return w+"w "+rd+"d ago";var y=Math.floor(w/52),rw=w%52;return y+"y "+rw+"w ago";} function hostOf(v){return String(v&&v.host||"internal").toLowerCase();} function hostName(v){var h=hostOf(v);return{claude:"Claude Code",codex:"Codex",internal:"Internal"}[h]||title(h);} function hostGlyph(v){return{claude:"✳",codex:"◉",internal:"⌁"}[hostOf(v)]||"⌁";}