From 6c767194d9470b368f8d337e0719795f235f683c Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 23 Mar 2026 00:42:44 +0000 Subject: fix: parse Todoist local datetimes, show near-future tasks, add undated tasks to timeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - parseDueDate: handle date field containing "YYYY-MM-DDTHH:MM:SS" (local time, no tz offset) — Todoist REST API v1 uses this format for recurring tasks with a set time, causing due dates to silently parse as nil - IsFuture threshold: widen from tomorrow to 7 days out so tasks due this week show in the main tasks section with dates visible (not collapsed) - BuildTimeline: include undated Todoist tasks in the Today section (mirrors existing Google Tasks behavior) - GetUndatedTasks: new store method for tasks with due_date IS NULL Co-Authored-By: Claude Sonnet 4.6 --- internal/api/todoist.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'internal/api/todoist.go') diff --git a/internal/api/todoist.go b/internal/api/todoist.go index d6058d3..2454233 100644 --- a/internal/api/todoist.go +++ b/internal/api/todoist.go @@ -3,6 +3,7 @@ package api import ( "context" "fmt" + "strings" "time" "task-dashboard/internal/config" @@ -239,8 +240,14 @@ func parseDueDate(due *dueInfo) *time.Time { dueDate = config.ToDisplayTZ(dueDate) } } else if due.Date != "" { - // Date-only, parse in display timezone - dueDate, err = config.ParseDateInDisplayTZ(due.Date) + // Todoist may put a local datetime (no tz offset) in the date field + // e.g. "2026-03-22T19:00:00" for recurring tasks with a set time. + // Fall back to date-only "2006-01-02" if no T is present. + if strings.Contains(due.Date, "T") { + dueDate, err = config.ParseDateTimeInDisplayTZ("2006-01-02T15:04:05", due.Date) + } else { + dueDate, err = config.ParseDateInDisplayTZ(due.Date) + } } if err != nil { return nil -- cgit v1.2.3