import Link from "next/link" import { Calendar, ChevronRight } from "lucide-react" import { TournamentStatusBadge, type TournamentStatus } from "@/components/tournament-status-badge" export type Tournament = { id: string name: string status: TournamentStatus startDate?: string endDate?: string } const dateFormatter = new Intl.DateTimeFormat("no-NO", { day: "numeric", month: "short", year: "numeric", }) function formatDate(value?: string) { if (!value) return null const parsed = new Date(value) if (Number.isNaN(parsed.getTime())) return null return dateFormatter.format(parsed) } function formatDateRange(start?: string, end?: string) { const from = formatDate(start) const to = formatDate(end) if (from && to) return from === to ? from : `${from} – ${to}` return from ?? to ?? null } export function TournamentCard({ tournament, orgId, }: { tournament: Tournament orgId: string }) { const dateRange = formatDateRange(tournament.startDate, tournament.endDate) return (

{tournament.name}

{dateRange ? (
) : ( Ingen datoer satt )}