// frontend/lib/calendar/time.ts — cal.jsx 의 toMin/fmt/topOf 이식
export const HSTART = 7;
export const PXH = 52;
export const HOURS = Array.from({ length: 16 }, (_, i) => 7 + i); // 7..22

export const toMin = (t: string): number => {
  const [h, m] = t.split(":").map(Number);
  return h * 60 + m;
};

export const fmt = (t: string): string => {
  const [h, m] = t.split(":").map(Number);
  const ap = h < 12 ? "오전" : "오후";
  const hh = h % 12 === 0 ? 12 : h % 12;
  return `${ap} ${hh}:${String(m).padStart(2, "0")}`;
};

export const topOf = (t: string): number => ((toMin(t) - HSTART * 60) / 60) * PXH;
