extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
1export function formatElapsedTime(timestamp: string): string {
2 const now = Date.now();
3 const then = new Date(timestamp).getTime();
4 const diffMs = now - then;
5
6 const minutes = Math.floor(diffMs / 60000);
7 const hours = Math.floor(minutes / 60);
8 const days = Math.floor(hours / 24);
9
10 if (minutes < 1) return 'just now';
11 if (minutes < 60) return `${minutes}m ago`;
12 if (hours < 24) return `${hours}h ago`;
13 if (days === 1) return '1 day ago';
14 return `${days} days ago`;
15}
16
17export function isStale(timestamp: string, thresholdDays: number = 3): boolean {
18 const now = Date.now();
19 const then = new Date(timestamp).getTime();
20 const diffDays = (now - then) / (1000 * 60 * 60 * 24);
21 return diffDays > thresholdDays;
22}