diff --git a/server/public.go b/server/public.go
index 36a3bc37..641b71c2 100644
--- a/server/public.go
+++ b/server/public.go
@@ -895,6 +895,10 @@ func formatUint32(i uint32) template.HTML {
}
func appendSeparatedNumberSpans(rv *strings.Builder, s, separatorClass string) {
+ if len(s) > 0 && s[0] == '-' {
+ s = s[1:]
+ rv.WriteByte('-')
+ }
t := (len(s) - 1) / 3
if t <= 0 {
rv.WriteString(s)
diff --git a/server/public_test.go b/server/public_test.go
index 189535de..2fb9477a 100644
--- a/server/public_test.go
+++ b/server/public_test.go
@@ -1625,11 +1625,32 @@ func Test_appendAmountSpan(t *testing.T) {
want: `1432134.23456 BTC`,
},
{
- name: "sec-amt 431341.23 EUR",
+ name: "sec-amt 1 EUR",
class: "sec-amt",
- amount: "4321341.23",
+ amount: "1",
shortcut: "EUR",
- want: `4321341.23 EUR`,
+ want: `1 EUR`,
+ },
+ {
+ name: "sec-amt -1 EUR",
+ class: "sec-amt",
+ amount: "-1",
+ shortcut: "EUR",
+ want: `-1 EUR`,
+ },
+ {
+ name: "sec-amt 432109.23 EUR",
+ class: "sec-amt",
+ amount: "432109.23",
+ shortcut: "EUR",
+ want: `432109.23 EUR`,
+ },
+ {
+ name: "sec-amt -432109.23 EUR",
+ class: "sec-amt",
+ amount: "-432109.23",
+ shortcut: "EUR",
+ want: `-432109.23 EUR`,
},
{
name: "sec-amt 43141.29 EUR",
@@ -1639,6 +1660,14 @@ func Test_appendAmountSpan(t *testing.T) {
txDate: "2022-03-14",
want: `43141.29 EUR`,
},
+ {
+ name: "sec-amt -43141.29 EUR",
+ class: "sec-amt",
+ amount: "-43141.29",
+ shortcut: "EUR",
+ txDate: "2022-03-14",
+ want: `-43141.29 EUR`,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {