From 920e029967f501b2478818f5523daeeeaabfce06 Mon Sep 17 00:00:00 2001 From: Alexander Hoare Date: Thu, 15 Jan 2026 20:22:50 +0000 Subject: [PATCH] Amended renderNumber to display numbers in the billions range (#2911) If this PR fixes an issue, link it below. If not, delete these two lines. Resolves [#2910](https://github.com/openfrontio/OpenFrontIO/issues/2910) ## Description: When any number is rendered using the Utils.ts renderNumber() function that is greater than 999,999,999, the display uses 1001M instead of 1B. Similar to existing logic, I expand the if statements to check if the number is greater than a threshold in the billions, and format it accordingly if so. Screenshots: image img1 ## Please complete the following: - [YES] I have added screenshots for all UI updates - [YES ] I process any text displayed to the user through translateText() and I've added it to the en.json file - [YES] I have added relevant tests to the test directory - [YES] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: visneh --- src/client/Utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/Utils.ts b/src/client/Utils.ts index 2f4e0dafd..ab56464f1 100644 --- a/src/client/Utils.ts +++ b/src/client/Utils.ts @@ -42,7 +42,13 @@ export function renderNumber( num = Number(num); num = Math.max(num, 0); - if (num >= 10_000_000) { + if (num >= 10_000_000_000) { + const value = Math.floor(num / 100000000) / 10; + return value.toFixed(fixedPoints ?? 1) + "B"; + } else if (num >= 1_000_000_000) { + const value = Math.floor(num / 10000000) / 100; + return value.toFixed(fixedPoints ?? 2) + "B"; + } else if (num >= 10_000_000) { const value = Math.floor(num / 100000) / 10; return value.toFixed(fixedPoints ?? 1) + "M"; } else if (num >= 1_000_000) {