From ad892a9f4ff7faa1b5c573fba38c18d64c23661c Mon Sep 17 00:00:00 2001 From: robhyrk Date: Tue, 4 Jun 2024 16:09:34 -0400 Subject: [PATCH] default to en-us for number formatting --- lib/util/format-compact.ts | 3 +-- lib/util/index.ts | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/util/format-compact.ts b/lib/util/format-compact.ts index eb0a08c46..e1c027551 100644 --- a/lib/util/format-compact.ts +++ b/lib/util/format-compact.ts @@ -2,11 +2,10 @@ export const formatNumberCompact = ( num: number | bigint, maximumSignificantDigits = 3, ) => { - const userLocale = navigator.language || "en-US"; // Ensure displaying absolute zeros are unsigned(-), because javascript sucks sometimes. if (num === 0 || num === 0n) num = 0; - return new Intl.NumberFormat(userLocale, { + return new Intl.NumberFormat("en-US", { maximumSignificantDigits: maximumSignificantDigits, notation: "compact", }).format(num); diff --git a/lib/util/index.ts b/lib/util/index.ts index f92f58f9d..899b505b1 100644 --- a/lib/util/index.ts +++ b/lib/util/index.ts @@ -30,15 +30,12 @@ const hexChars = [ export const formatNumberLocalized = ( num: number | bigint, - maximumFractionDigits: number = 3, + maximumFractionDigits: number = 2, ) => { - const userLocale = navigator.language || "en-US"; // Ensure displaying absolute zeros are unsigned(-), because javascript sucks sometimes. if (num === 0 || num === 0n) num = 0; - return new Intl.NumberFormat(userLocale, { maximumFractionDigits }).format( - num, - ); + return new Intl.NumberFormat("en-US", { maximumFractionDigits }).format(num); }; export const isValidPolkadotAddress = (address: string) => {