Datum implementiert
All checks were successful
release-tag / release-image (push) Successful in 2m11s
All checks were successful
release-tag / release-image (push) Successful in 2m11s
This commit is contained in:
10
main.go
10
main.go
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
_ "modernc.org/sqlite" // statt github.com/mattn/go-sqlite3
|
||||
)
|
||||
@@ -62,6 +63,13 @@ var tmpl = template.Must(template.New("form").Funcs(template.FuncMap{
|
||||
}
|
||||
return math.Floor(a / b)
|
||||
},
|
||||
"formatDate": func(dateStr string) string {
|
||||
t, err := time.Parse("2006-01-02 15:04:05", dateStr)
|
||||
if err != nil {
|
||||
return "?"
|
||||
}
|
||||
return t.Format("02.01.2006")
|
||||
},
|
||||
}).Parse(htmlTemplate))
|
||||
|
||||
// Tausendertrenner für deutsche Zahlendarstellung (z. B. 12345 → "12.345")
|
||||
@@ -410,6 +418,7 @@ const htmlTemplate = `
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Datum</th>
|
||||
<th>Anfang</th>
|
||||
<th>Ende</th>
|
||||
<th>Profit</th>
|
||||
@@ -423,6 +432,7 @@ const htmlTemplate = `
|
||||
{{range .Entries}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td>{{formatDate .CreatedAt}}</td>
|
||||
<td>{{formatNumber .Anfangsbestand}}</td>
|
||||
<td>{{formatNumber .Endbestand}}</td>
|
||||
<td>{{formatNumber .Gesamtwert}}</td>
|
||||
|
Reference in New Issue
Block a user