The name and tagline live in one place, shared/utils/site.ts, and feed the header, the footer, the home page and the title template.
11 lines
464 B
TypeScript
11 lines
464 B
TypeScript
/** Human-readable date for display; returns an empty string when unset. */
|
|
export function formatDate(value: string | null | undefined): string {
|
|
if (!value) return ''
|
|
return new Intl.DateTimeFormat('en-GB', { dateStyle: 'long' }).format(new Date(value))
|
|
}
|
|
|
|
/** Machine-readable date for the `datetime` attribute and structured data. */
|
|
export function isoDate(value: string | null | undefined): string {
|
|
return value ? new Date(value).toISOString() : ''
|
|
}
|