fix: numbers follow the UI language, not the browser's
`n.toLocaleString()` groups in the BROWSER's locale, so an English UI in a
Hungarian browser printed "1 234 567" while a Hungarian UI in an English
browser printed "1,234,567" — the number half of the date defect fixed in
618ef812. One `formatNumber` in lib/format.ts (a per-language cached
Intl.NumberFormat, like the relative-time formatters beside it) now serves
every grouped figure: Stats, Scheduler, the channel columns and the stats
popover, VideoCard's view tooltip, the ItemCount pill, and formatTotalHours.
ReleaseNotes' `toLocaleDateString(undefined, …)` was the one DATE site the
previous sweep missed; it moves onto formatDate.
The new cases assert both languages and that the two differ, instead of
comparing against the runtime's own default: that default is Hungarian on the
dev box and English on a CI image, so a one-language assertion would pass
under the old bug on half the machines. Verified in Chromium on :5173 with the
browser forced to hu-HU and the UI in English — Stats, Scheduler and the
channel table all keep comma grouping.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Bug, Sparkles } from "lucide-react";
|
||||
import { RELEASE_NOTES } from "../lib/releaseNotes";
|
||||
import { formatDate } from "../lib/format";
|
||||
import Modal from "./ui/Modal";
|
||||
|
||||
function fmtDate(d: string): string {
|
||||
const t = new Date(d);
|
||||
return isNaN(t.getTime())
|
||||
? d
|
||||
: t.toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" });
|
||||
// The release date in the UI language — `toLocaleDateString(undefined, …)` formats in the BROWSER's
|
||||
// locale, which put Hungarian-shaped dates in an English release-notes list. Unparseable input falls
|
||||
// back to the raw string (a hand-written note could carry anything).
|
||||
function fmtDate(d: string, lang: string): string {
|
||||
return isNaN(new Date(d).getTime()) ? d : formatDate(d, lang);
|
||||
}
|
||||
|
||||
// Public release notes (chores are intentionally omitted here). `highlight` rings the
|
||||
@@ -19,7 +20,7 @@ export default function ReleaseNotes({
|
||||
onClose: () => void;
|
||||
highlight?: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
// Ring the newest note if `highlight` isn't one of the listed versions — e.g. a Vite dev build
|
||||
// where the caller's FRONTEND_VERSION is "dev", or a VERSION bump whose note hasn't landed yet —
|
||||
// so the banner always rings *something* current instead of nothing.
|
||||
@@ -36,7 +37,7 @@ export default function ReleaseNotes({
|
||||
>
|
||||
<div className="flex items-baseline gap-2 flex-wrap">
|
||||
<h3 className="text-base font-semibold">v{r.version}</h3>
|
||||
<span className="text-xs text-muted">{fmtDate(r.date)}</span>
|
||||
<span className="text-xs text-muted">{fmtDate(r.date, i18n.language)}</span>
|
||||
{r.sha && (
|
||||
<span className="text-2xs font-mono text-muted bg-surface px-1.5 py-0.5 rounded-sm">
|
||||
{r.sha}
|
||||
|
||||
Reference in New Issue
Block a user