{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "date",
  "title": "date",
  "description": "date",
  "files": [
    {
      "path": "src/lib/date.ts",
      "content": "export function formatDatetime(input?: string): string {\n  const date = input ? new Date(input) : new Date()\n  const now = new Date()\n\n  return date\n    .toLocaleString(\"en-GB\", {\n      day: \"2-digit\",\n      month: \"short\",\n      year: date.getFullYear() === now.getFullYear() ? undefined : \"numeric\",\n      hour: \"2-digit\",\n      minute: \"2-digit\",\n      hour12: false,\n    })\n    .replace(\",\", \"\")\n}\n\nexport function formatDate(input?: string | Date): string {\n  const date = input ? new Date(input) : new Date()\n  const now = new Date()\n\n  return date.toLocaleDateString(\"en-GB\", {\n    day: \"2-digit\",\n    month: \"short\",\n    year: date.getFullYear() === now.getFullYear() ? undefined : \"numeric\",\n  })\n}\n\nconst DAY_MS = 24 * 60 * 60 * 1000\n\nexport function getCalendarDaysUntil(deadline: Date): number | null {\n  const now = new Date()\n  if (now.getTime() >= deadline.getTime()) return null\n\n  const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate())\n  const startOfDeadlineDay = new Date(\n    deadline.getFullYear(),\n    deadline.getMonth(),\n    deadline.getDate()\n  )\n  const days = Math.round((startOfDeadlineDay.getTime() - startOfToday.getTime()) / DAY_MS)\n  return Math.max(0, days)\n}\n\nexport function formatDaysLeft(count: number): string {\n  if (count === 1) return \"1 day left\"\n  return `${count} days left`\n}\n\nexport function formatHumans(date: Date) {\n  const diff = Date.now() - date.getTime()\n  const s = Math.floor(diff / 1000)\n  const m = Math.floor(s / 60)\n  const h = Math.floor(m / 60)\n  const d = Math.floor(h / 24)\n  if (s < 60) return \"just now\"\n  if (m < 60) return `${m}m ago`\n  if (h < 24) return `${h}h ago`\n  return `${d}d ago`\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:lib"
}