MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / formatRelativeAge

Function formatRelativeAge

integrations/raycast/src/search-notes.tsx:432–446  ·  view source on GitHub ↗
(updatedAt: number)

Source from the content-addressed store, hash-verified

430}
431
432function formatRelativeAge(updatedAt: number): string {
433 if (!updatedAt) return "";
434 const diff = Date.now() - updatedAt;
435 if (diff < 0) return "just now";
436 const minutes = Math.floor(diff / 60_000);
437 if (minutes < 1) return "just now";
438 if (minutes < 60) return `${minutes}m ago`;
439 const hours = Math.floor(minutes / 60);
440 if (hours < 24) return `${hours}h ago`;
441 const days = Math.floor(hours / 24);
442 if (days < 30) return `${days}d ago`;
443 const months = Math.floor(days / 30);
444 if (months < 12) return `${months}mo ago`;
445 return `${Math.floor(months / 12)}y ago`;
446}

Callers 1

noteAccessoriesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected