/** * Builds an org-scoped URL for the wildcard org route (/org/_). * * When `slug` is undefined or empty, the destination is the org project list at * /org/. When `slug` has segments, the sub-path is preserved so the * user lands on the equivalent page for the chosen org. */ export function buildOrgUrl({ slug, orgSlug, queryString, }: { slug: string[] | undefined orgSlug: string queryString: string }): string { const qs = queryString ? `?${queryString}` : '' if (!slug?.length) { return `/org/${orgSlug}${qs}` } return `/org/${orgSlug}/${slug.join('/')}${qs}` } // Invite is expired if older than 24hrs export function isInviteExpired(timestamp: string) { const inviteDate = new Date(timestamp) const now = new Date() const timeBetween = now.valueOf() - inviteDate.valueOf() if (timeBetween / 1000 / 60 / 60 < 24) { return false } return true }