MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / getRelativeTime

Function getRelativeTime

src/components/WalletButton.tsx:47–54  ·  view source on GitHub ↗
(iso: string)

Source from the content-addressed store, hash-verified

45}
46
47function getRelativeTime(iso: string): string {
48 const diff = Date.now() - new Date(iso).getTime();
49 const secs = Math.floor(diff / 1000);
50 if (secs < 60) return `${secs}s ago`;
51 const mins = Math.floor(secs / 60);
52 if (mins < 60) return `${mins}m ago`;
53 return `${Math.floor(mins / 60)}h ago`;
54}
55
56function CopyButton({ text }: { text: string }) {
57 const { t } = useI18n();

Callers 1

WalletButtonFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected