/**
 * The one hand-written date formatter for pure TS (non-template) code — a domain
 * rule or a `$localize` string can't reach for Angular's `DatePipe`, so this covers
 * that gap. Templates use `DatePipe` (`| date: 'longDate'`) instead; don't add a
 * second hand-rolled formatter for either case.
 */
export function formatDatumNl(d: Date | string | undefined | null): string {
  if (!d) return '';
  const date = typeof d === 'string' ? new Date(d) : d;
  if (Number.isNaN(date.getTime())) return '';
  return new Intl.DateTimeFormat('nl-NL', {
    day: 'numeric',
    month: 'long',
    year: 'numeric',
  }).format(date);
}
