{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lib-time",
  "type": "registry:lib",
  "title": "lib/time",
  "description": "시각은 항상 24시간제 문자열 \"HH:mm\" / \"HH:mm:ss\" 로 주고받습니다.",
  "files": [
    {
      "path": "poc/design-system/implement/src/lib/time.ts",
      "content": "/** 시각은 항상 24시간제 문자열 \"HH:mm\" / \"HH:mm:ss\" 로 주고받습니다. */\nexport type TimeParts = { hour: number | null; minute: number | null; second: number | null };\n\nconst TIME_RE = /^(\\d{2}):(\\d{2})(?::(\\d{2}))?$/;\n\nexport function parseTime(value: string | null | undefined): TimeParts {\n  const match = value ? TIME_RE.exec(value) : null;\n  if (!match) return { hour: null, minute: null, second: null };\n  return { hour: Number(match[1]), minute: Number(match[2]), second: match[3] ? Number(match[3]) : null };\n}\n\nexport function formatTime(p: TimeParts, showSeconds: boolean): string | null {\n  if (p.hour === null || p.minute === null) return null;\n  if (showSeconds && p.second === null) return null;\n  const base = `${String(p.hour).padStart(2, \"0\")}:${String(p.minute).padStart(2, \"0\")}`;\n  return showSeconds ? `${base}:${String(p.second).padStart(2, \"0\")}` : base;\n}\n\nexport function toSeconds(value: string): number {\n  const { hour, minute, second } = parseTime(value);\n  return (hour ?? 0) * 3600 + (minute ?? 0) * 60 + (second ?? 0);\n}\n\nexport function isTimeInRange(value: string, min?: string, max?: string) {\n  const s = toSeconds(value);\n  return (!min || s >= toSeconds(min)) && (!max || s <= toSeconds(max));\n}\n",
      "type": "registry:lib",
      "target": "components/lib/time.ts"
    }
  ],
  "categories": [
    "internal"
  ],
  "meta": {
    "version": "0.1.0"
  }
}
