---
interface Props {
	className?: string;
	date: Date | string;
	hidden?: boolean;
}

let { className, date, hidden } = Astro.props;
if (typeof(date) === 'string') {
	date = new Date(date);
}
const dateStr =
  date.toLocaleDateString('en-GB', {
			year: 'numeric',
			month: 'long',
			day: 'numeric',
		});
---

{ hidden
  ? <time datetime={date.toISOString()} class={className ?? ''} hidden>{dateStr}</time>
  : <time datetime={date.toISOString()} class={className ?? ''}>{dateStr}</time>
}
