diff --git a/modules/lk/lk.go b/modules/lk/lk.go index c77d1b9..d09a447 100644 --- a/modules/lk/lk.go +++ b/modules/lk/lk.go @@ -79,6 +79,12 @@ func New(cfg Config) (*Server, error) { } return strings.ReplaceAll(s, ".", ",") + " %" }, + "fmtdate": func(iso string) string { // 2026-09-18 → 18.09.2026 + if t, err := time.Parse("2006-01-02", iso); err == nil { + return t.Format("02.01.2006") + } + return iso + }, "fmtpct1": func(f float64) string { // 84,1% return strings.ReplaceAll(strconv.FormatFloat(f, 'f', 1, 64), ".", ",") + "%" }, @@ -765,6 +771,11 @@ func (s *Server) buildHandler() http.Handler { s.render(w, r, "operations", data) return } + sort.SliceStable(out.Rows, func(i, j int) bool { // свежие сверху, независимо от порядка в ответе + di, _ := time.Parse("02.01.2006", out.Rows[i].Date) + dj, _ := time.Parse("02.01.2006", out.Rows[j].Date) + return di.After(dj) + }) var buy, sell, income float64 for _, o := range out.Rows { switch o.Kind { diff --git a/modules/lk/templates.go b/modules/lk/templates.go index 0a991cc..05684ad 100644 --- a/modules/lk/templates.go +++ b/modules/lk/templates.go @@ -490,7 +490,7 @@ input[type=checkbox]{width:20px;min-height:20px;height:20px}