144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
29 lines
813 B
TypeScript
29 lines
813 B
TypeScript
import type { Locale } from '@/i18n/types'
|
|
|
|
export function todayIso(): string {
|
|
return new Date().toISOString().slice(0, 10)
|
|
}
|
|
|
|
export function nowIso(): string {
|
|
return new Date().toISOString()
|
|
}
|
|
|
|
const LOCALE_TAG: Record<Locale, string> = {
|
|
fr: 'fr-FR',
|
|
en: 'en-US',
|
|
}
|
|
|
|
export function formatDate(isoDate: string, locale: Locale): string {
|
|
const match = isoDate.match(/^(\d{4})-(\d{2})-(\d{2})$/)
|
|
if (!match) throw new Error(`Invalid ISO date: ${isoDate}`)
|
|
const [, y, mo, d] = match
|
|
const date = new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)))
|
|
if (Number.isNaN(date.getTime())) throw new Error(`Invalid ISO date: ${isoDate}`)
|
|
return new Intl.DateTimeFormat(LOCALE_TAG[locale], {
|
|
day: 'numeric',
|
|
month: 'long',
|
|
year: 'numeric',
|
|
timeZone: 'UTC',
|
|
}).format(date)
|
|
}
|