(iso: string)
| 23 | }; |
| 24 | |
| 25 | const formatRelativeTime = (iso: string): string => { |
| 26 | const then = new Date(iso).getTime(); |
| 27 | if (Number.isNaN(then)) return ""; |
| 28 | const diffMs = Date.now() - then; |
| 29 | const min = Math.floor(diffMs / 60_000); |
| 30 | if (min < 1) return "just now"; |
| 31 | if (min < 60) return `${min}m ago`; |
| 32 | const hrs = Math.floor(min / 60); |
| 33 | if (hrs < 24) return `${hrs}h ago`; |
| 34 | const days = Math.floor(hrs / 24); |
| 35 | if (days < 7) return `${days}d ago`; |
| 36 | const weeks = Math.floor(days / 7); |
| 37 | if (weeks < 5) return `${weeks}w ago`; |
| 38 | const months = Math.floor(days / 30); |
| 39 | if (months < 12) return `${months}mo ago`; |
| 40 | return `${Math.floor(days / 365)}y ago`; |
| 41 | }; |
| 42 | |
| 43 | export const CreateOrgPage = () => { |
| 44 | const auth = useAuth(); |
no outgoing calls
no test coverage detected