my website
at main 28 lines 538 B view raw
1--- 2import type { DateFormat } from "./Intro.astro"; 3 4interface Props { 5 date: Date; 6 dateFormat?: DateFormat; 7 class?: string; 8} 9 10const { date, dateFormat, class: className, ...props } = Astro.props; 11 12let formatted; 13if (dateFormat) { 14 formatted = dateFormat(date); 15} else { 16 formatted = date.toLocaleDateString("en-uk", { 17 year: "numeric", 18 month: "short", 19 day: "numeric", 20 }); 21} 22--- 23 24<time 25 class={`uppercase text-fg/80 tabular-nums ${className || ""}`} 26 datetime={date.toISOString()} 27 {...props}>{formatted}</time 28>