all repos — piggy @ 8707df94ac518748da0ec8f8d60b0a4208e3e7b9

Dead simple finance manager in Go, HTML and JS.

better formatting
Marco Andronaco andronacomarco@gmail.com
Sun, 06 Oct 2024 14:59:25 +0200
commit

8707df94ac518748da0ec8f8d60b0a4208e3e7b9

parent

ed5fd22c5fa0cb0923a3d5db1f9869a3cc61e340

2 files changed, 8 insertions(+), 2 deletions(-)

jump to
M static/js/bookmakers.jsstatic/js/bookmakers.js

@@ -40,7 +40,7 @@ bookmaker.id,

formatDate(bookmaker.created_at), formatDate(bookmaker.updated_at), bookmaker.name, - bookmaker.default_commission, + formatPercentage(bookmaker.default_commission), ]; for (const field of fields) {
M static/js/common.jsstatic/js/common.js

@@ -25,7 +25,13 @@ return (v / 100).toFixed(2);

} function formatCash(v) { - return formatValue(v) + currency; + if (v === 0) return "-"; + return `${v > 0 ? "+" : ""}${formatValue(v)}${currency}`; +} + +function formatPercentage(v) { + if (v === 0) return "-"; + return formatValue(v) + "%"; } function formatDate(dateString) {