MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / relativeTime

Function relativeTime

dashboard/shell/src/sdk.jsx:100–107  ·  view source on GitHub ↗
(deltaSeconds)

Source from the content-addressed store, hash-verified

98}
99
100function relativeTime(deltaSeconds) {
101 if (Number.isNaN(deltaSeconds)) return "unknown";
102 if (deltaSeconds < 60) return "just now";
103 if (deltaSeconds < 3600) return `${Math.floor(deltaSeconds / 60)}m ago`;
104 if (deltaSeconds < 86400) return `${Math.floor(deltaSeconds / 3600)}h ago`;
105 if (deltaSeconds < 172800) return "yesterday";
106 return `${Math.floor(deltaSeconds / 86400)}d ago`;
107}
108
109/** Relative time from a unix-seconds timestamp. */
110export function timeAgo(ts) {

Callers 2

timeAgoFunction · 0.85
isoTimeAgoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected