Print kroner whole and sats as whole numbers
This commit is contained in:
1 parent
2244a69ffc
commit
d12df91acc
1 file changed
+11
-8
+11
-8
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user