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/handlers/timeline_logic_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'internal/handlers/timeline_logic_test.go') diff --git a/internal/handlers/timeline_logic_test.go b/internal/handlers/timeline_logic_test.go index b42ad4c..8104a96 100644 --- a/internal/handlers/timeline_logic_test.go +++ b/internal/handlers/timeline_logic_test.go @@ -462,6 +462,36 @@ func TestSaveAndGetCalendarEvents(t *testing.T) { } } +func TestBuildTimeline_IncludesUndatedTodoistTasks(t *testing.T) { + s := setupTestStore(t) + + // Save a task with no due date + _ = s.SaveTasks([]models.Task{ + {ID: "undated1", Content: "Take out recycling"}, // DueDate is nil + }) + + start := time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC) + end := time.Date(2023, 1, 2, 0, 0, 0, 0, time.UTC) + + items, err := BuildTimeline(context.Background(), s, nil, start, end) + if err != nil { + t.Fatalf("BuildTimeline failed: %v", err) + } + + found := false + for _, item := range items { + if item.ID == "undated1" { + found = true + if item.DaySection != models.DaySectionToday { + t.Errorf("Undated task should be in Today section, got %s", item.DaySection) + } + } + } + if !found { + t.Error("Undated Todoist task should appear in timeline Today section") + } +} + func timePtr(t time.Time) *time.Time { return &t } -- cgit v1.2.3