MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / formatCountdown

Function formatCountdown

src/components/BuiltinStatusLine.tsx:28–39  ·  view source on GitHub ↗
(epochSeconds: number)

Source from the content-addressed store, hash-verified

26 * Returns a compact human-readable string like "3h12m", "5d20h", "45m", or "now".
27 */
28export function formatCountdown(epochSeconds: number): string {
29 const diff = epochSeconds - Date.now() / 1000;
30 if (diff <= 0) return 'now';
31
32 const days = Math.floor(diff / 86400);
33 const hours = Math.floor((diff % 86400) / 3600);
34 const minutes = Math.floor((diff % 3600) / 60);
35
36 if (days >= 1) return `${days}d${hours}h`;
37 if (hours >= 1) return `${hours}h${minutes}m`;
38 return `${minutes}m`;
39}
40
41function Separator() {
42 return <Text dimColor>{' \u2502 '}</Text>;

Callers 1

BuiltinStatusLineInnerFunction · 0.70

Calls 1

nowMethod · 0.80

Tested by

no test coverage detected