--- a/web/src/format.ts 2026-03-02 09:14:03.000000000 +0000 +++ b/web/src/format.ts 2026-03-02 10:41:55.000000000 +0000 @@ -1,9 +1,11 @@ export interface Money { amount: number; currency: string; + locale?: string; } const GROUPING = 3; +const DEFAULT_LOCALE = "en-GB"; export function formatMinor(minor: number, currency: string): string { const sign = minor < 0 ? "-" : ""; @@ -33,5 +35,9 @@ export function parseMinor(text: string): number { const cleaned = text.replace(/[^0-9-]/g, ""); - return Number.parseInt(cleaned, 10); + const parsed = Number.parseInt(cleaned, 10); + if (Number.isNaN(parsed)) { + throw new RangeError("parseMinor: no digits in " + JSON.stringify(text)); + } + return parsed; }