From 42a4e32daca13b518e64e5821080ff3d6adf0e39 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 26 Jan 2026 16:49:44 -1000 Subject: Use configured timezone throughout codebase - Add config/timezone.go with timezone utilities: - SetDisplayTimezone(), GetDisplayTimezone() - Now(), Today() - current time/date in display TZ - ParseDateInDisplayTZ(), ToDisplayTZ() - parsing helpers - Initialize timezone at startup in main.go - Update all datetime logic to use configured timezone: - handlers/handlers.go - all time.Now() calls - handlers/timeline.go - date parsing - handlers/timeline_logic.go - now calculation - models/atom.go - ComputeUIFields() - models/timeline.go - ComputeDaySection() - api/plantoeat.go - meal date parsing - api/todoist.go - due date parsing - api/trello.go - due date parsing This ensures all dates/times display correctly regardless of server timezone setting. Co-Authored-By: Claude Opus 4.5 --- internal/api/plantoeat.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/api/plantoeat.go') diff --git a/internal/api/plantoeat.go b/internal/api/plantoeat.go index 5c24cc1..ab5d2cd 100644 --- a/internal/api/plantoeat.go +++ b/internal/api/plantoeat.go @@ -11,6 +11,7 @@ import ( "github.com/PuerkitoBio/goquery" + "task-dashboard/internal/config" "task-dashboard/internal/models" ) @@ -90,8 +91,7 @@ func parsePlannerHTML(body io.Reader, days int) ([]models.Meal, error) { } var meals []models.Meal - now := time.Now() - today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + today := config.Today() endDate := today.AddDate(0, 0, days) // PlanToEat structure: @@ -108,7 +108,7 @@ func parsePlannerHTML(body io.Reader, days int) ([]models.Meal, error) { return } - mealDate, err := time.Parse("2006-01-02", dateStr) + mealDate, err := config.ParseDateInDisplayTZ(dateStr) if err != nil { return } -- cgit v1.2.3