Print kroner whole and sats as whole numbers

This commit is contained in:
ai-bot committed 2026-11-14 18:20:47 +00:00
1 parent 2244a69ffc
commit d12df91acc
1 file changed
+11 -8
+11 -8
View File
@@ -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) {