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);
|
return sign + group(value.slice(0, -2)) + "," + value.slice(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Whole kroner, halves rounded up, grouped with spaces and the unit. */
|
||||||
function formatKroner(ore) {
|
function formatKroner(ore) {
|
||||||
var text = formatOre(ore);
|
if (ore === null || ore === undefined || ore === "") {
|
||||||
return text === "" ? "" : text + " kr";
|
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) {
|
function formatSats(sats) {
|
||||||
if (sats === null || sats === undefined || sats === "") {
|
if (sats === null || sats === undefined || sats === "") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
var value = String(Math.abs(Number(sats)));
|
var value = Number(sats);
|
||||||
while (value.length < 9) {
|
var sign = value < 0 ? "-" : "";
|
||||||
value = "0" + value;
|
return sign + group(String(Math.abs(value)));
|
||||||
}
|
|
||||||
var sign = Number(sats) < 0 ? "-" : "";
|
|
||||||
return sign + value.slice(0, -8) + "," + value.slice(-8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatPercent(value) {
|
function formatPercent(value) {
|
||||||
|
|||||||
Reference in new issue
Block a user