From d12df91acca23756a7b7b4eede9572926b5a2614 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 14 Nov 2026 18:20:47 +0000 Subject: [PATCH] Print kroner whole and sats as whole numbers --- static/app.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/static/app.js b/static/app.js index ee70c37..ae2a7c6 100644 --- a/static/app.js +++ b/static/app.js @@ -47,21 +47,24 @@ return sign + group(value.slice(0, -2)) + "," + value.slice(-2); } + /* Whole kroner, halves rounded up, grouped with spaces and the unit. */ function formatKroner(ore) { - var text = formatOre(ore); - return text === "" ? "" : text + " kr"; + if (ore === null || ore === undefined || ore === "") { + return ""; + } + var value = Number(ore); + var sign = value < 0 ? "-" : ""; + return sign + group(String(Math.round(Math.abs(value) / 100))) + " kr"; } + /* A whole number of sats, grouped with spaces. No unit and no decimals. */ function formatSats(sats) { if (sats === null || sats === undefined || sats === "") { return ""; } - var value = String(Math.abs(Number(sats))); - while (value.length < 9) { - value = "0" + value; - } - var sign = Number(sats) < 0 ? "-" : ""; - return sign + value.slice(0, -8) + "," + value.slice(-8); + var value = Number(sats); + var sign = value < 0 ? "-" : ""; + return sign + group(String(Math.abs(value))); } function formatPercent(value) {