blog.hangerthem.com/utils/time.ts
HangerThem 98212889bf chore: README, dependency cleanup and shared components
- Replace the create-next-app README with real project docs (features,
  env vars, frontmatter schema, Markdown extensions, deployment)
- Drop ESLint (unused by any script; oxlint is the linter) and the
  unrelated 'hast' package; move oxlint, oxfmt and puppeteer to
  devDependencies (locked versions unchanged)
- Extract PostList, used by the tag and category pages
- Use shared Intl formatters for post dates, pinned to Europe/Prague so
  the build server's timezone can't shift dates
- Use <h1> for the tag/category page headings (same styling)
- Remove math/mermaid flags from posts that don't use them; fix a typo
  in the Tessera cover alt text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:25:58 +02:00

25 lines
692 B
TypeScript

// Posts are written in Czech time; pin the zone so the build server's timezone doesn't shift dates
const timeZone = 'Europe/Prague'
/** Long date for listings, e.g. "September 18, 2026". */
export const dateFormatter = new Intl.DateTimeFormat('en', {
day: 'numeric',
month: 'long',
year: 'numeric',
timeZone,
})
/** Compact date for post headers, e.g. "Sep 18, 2026". */
export const shortDateFormatter = new Intl.DateTimeFormat('en', {
day: 'numeric',
month: 'short',
year: 'numeric',
timeZone,
})
/** Full date and time, used for hover titles. */
export const dateTimeFormatter = new Intl.DateTimeFormat('en', {
dateStyle: 'long',
timeStyle: 'short',
timeZone,
})