/** Formats a date-only ISO string (YYYY-MM-DD) for display in the active locale.
 *  Parses as local midnight so a date-only value isn't shifted a day by tz. */
export function formatDate(value: unknown, lang: string): string {
  if (typeof value !== "string") return value == null ? "—" : String(value);
  const date = new Date(`${value}T00:00:00`);
  if (Number.isNaN(date.getTime())) return value;
  return new Intl.DateTimeFormat(lang, { dateStyle: "medium" }).format(date);
}
