From 00d7296dc224094778f03005bcc845e5fed867ba Mon Sep 17 00:00:00 2001 From: Tim Wundenberg Date: Mon, 16 Jun 2025 12:52:49 +0200 Subject: [PATCH] fix(dashboard): #163 month selection on first load --- internal/handler/root_and_404.go | 2 +- internal/template/dashboard/dashboard.templ | 2 +- static/js/time.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/handler/root_and_404.go b/internal/handler/root_and_404.go index 2430f6e..cc29eaa 100644 --- a/internal/handler/root_and_404.go +++ b/internal/handler/root_and_404.go @@ -81,7 +81,7 @@ func (handler IndexImpl) dashboard(user *types.User, htmx bool, r *http.Request) return nil, fmt.Errorf("could not parse timestamp: %w", service.ErrBadRequest) } } else { - month = time.Now() + month = time.Now().UTC() } summary, err := handler.d.Summary(r.Context(), user, month) diff --git a/internal/template/dashboard/dashboard.templ b/internal/template/dashboard/dashboard.templ index 3997ec7..f69f88c 100644 --- a/internal/template/dashboard/dashboard.templ +++ b/internal/template/dashboard/dashboard.templ @@ -9,7 +9,7 @@ templ Dashboard(summary *types.DashboardMonthlySummary) { diff --git a/static/js/time.js b/static/js/time.js index 3023997..1adeebd 100644 --- a/static/js/time.js +++ b/static/js/time.js @@ -17,6 +17,7 @@ function updateTime() { const newDate = value.includes("UTC") ? new Date(value) : value; el.valueAsDate = newDate; } + el.classList.remove("datetime"); }) }