fix: a calendar date is the same day everywhere; legal pages use the shared language picker
formatDate read a date-only value as UTC midnight and showed it in the viewer's zone, so the legal pages' last update read a day early west of UTC. Date-only values are shown in UTC. The legal pages' hand-rolled language buttons are the landing page's LanguageSwitcher. formatDateTime and formatDate get the two-language test formatNumber already had.
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { LANGUAGES, setLanguage } from "../../i18n";
|
||||
import { setLanguage, type LangCode } from "../../i18n";
|
||||
import { formatDate } from "../../lib/format";
|
||||
import { send } from "../../lib/http";
|
||||
import LanguageSwitcher from "../LanguageSwitcher";
|
||||
|
||||
// The day the text last changed materially — bump it with every edit of either body.
|
||||
const LAST_UPDATED = "2026-09-17";
|
||||
@@ -77,20 +78,8 @@ export default function LegalLayout({ title, children }: { title: string; childr
|
||||
<a href="/" className="inline-block text-2xl font-bold tracking-tight">
|
||||
Sift<span className="text-accent">lode</span>
|
||||
</a>
|
||||
<div role="group" aria-label={t("legal.languageLabel")} className="flex gap-1 text-xs">
|
||||
{LANGUAGES.map((lang) => (
|
||||
<button
|
||||
key={lang.code}
|
||||
type="button"
|
||||
lang={lang.code}
|
||||
aria-pressed={i18n.language?.startsWith(lang.code) ?? false}
|
||||
onClick={() => setLanguage(lang.code)}
|
||||
className="rounded-md px-2 py-1 text-muted hover:text-fg aria-pressed:bg-card aria-pressed:text-fg"
|
||||
>
|
||||
{lang.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{/* The landing page's own picker, so the public pages switch language one way. */}
|
||||
<LanguageSwitcher value={i18n.language as LangCode} onChange={setLanguage} />
|
||||
</div>
|
||||
<div className="glass rounded-2xl p-8">
|
||||
<h1 className="text-2xl font-semibold">{title}</h1>
|
||||
|
||||
Reference in New Issue
Block a user