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/todoist.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/api/todoist.go') diff --git a/internal/api/todoist.go b/internal/api/todoist.go index 2c94e08..6068d2e 100644 --- a/internal/api/todoist.go +++ b/internal/api/todoist.go @@ -5,6 +5,7 @@ import ( "fmt" "time" + "task-dashboard/internal/config" "task-dashboard/internal/models" ) @@ -287,9 +288,14 @@ func parseDueDate(due *dueInfo) *time.Time { var dueDate time.Time var err error if due.Datetime != "" { + // RFC3339 includes timezone, then convert to display timezone dueDate, err = time.Parse(time.RFC3339, due.Datetime) + if err == nil { + dueDate = config.ToDisplayTZ(dueDate) + } } else if due.Date != "" { - dueDate, err = time.Parse("2006-01-02", due.Date) + // Date-only, parse in display timezone + dueDate, err = config.ParseDateInDisplayTZ(due.Date) } if err != nil { return nil -- cgit v1.2.3