Skip to content

Commit b7fc619

Browse files
authored
fix: cascade dashboard relative-time labels beyond hours (#75)
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.
1 parent 796b904 commit b7fc619

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/lib/dashboard/live/client.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const LIVE_JS = `
2424
function esc(s){return String(s==null?"":s).replace(/[&<>"']/g,function(c){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[c];});}
2525
function short(s,n){s=String(s||"");return s.length>n?s.slice(0,n-1)+"…":s;}
2626
function title(s){return String(s||"activity").replace(/[._-]+/g," ").replace(/\\b\\w/g,function(c){return c.toUpperCase();});}
27-
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";}
27+
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";}
2828
function hostOf(v){return String(v&&v.host||"internal").toLowerCase();}
2929
function hostName(v){var h=hostOf(v);return{claude:"Claude Code",codex:"Codex",internal:"Internal"}[h]||title(h);}
3030
function hostGlyph(v){return{claude:"✳",codex:"◉",internal:"⌁"}[hostOf(v)]||"⌁";}

0 commit comments

Comments
 (0)