export function formatDate(iso: string | null | undefined): string {
  if (!iso) return '-';
  let s = iso.trim();
  if (!s.includes('T')) s = s.replace(' ', 'T');
  // Truncate microseconds: 2026-05-13T15:04:04.313751 → 2026-05-13T15:04:04
  const dotIdx = s.indexOf('.');
  if (dotIdx > 0) s = s.slice(0, dotIdx);
  // Remove any trailing timezone info (backend now sends naive datetimes)
  s = s.replace(/[+-]\d{2}:?\d{0,2}$/, '').replace(/Z$/, '');
  return s.replace('T', ' ').slice(0, 16);
}
