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/models/atom_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'internal/models/atom_test.go') diff --git a/internal/models/atom_test.go b/internal/models/atom_test.go index 3ed4774..70bc14b 100644 --- a/internal/models/atom_test.go +++ b/internal/models/atom_test.go @@ -134,6 +134,40 @@ func TestAtom_ComputeUIFields(t *testing.T) { } }) + // Tasks due within 7 days should NOT be IsFuture (shown in main section with dates) + t.Run("tomorrow is not future", func(t *testing.T) { + tz := time.UTC + now := time.Now().In(tz) + tomorrow := time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, tz) + atom := Atom{DueDate: &tomorrow} + atom.ComputeUIFields() + if atom.IsFuture { + t.Error("Task due tomorrow should not be IsFuture — it should appear in main tasks section with its date visible") + } + }) + + t.Run("6 days out is not future", func(t *testing.T) { + tz := time.UTC + now := time.Now().In(tz) + sixDays := time.Date(now.Year(), now.Month(), now.Day()+6, 0, 0, 0, 0, tz) + atom := Atom{DueDate: &sixDays} + atom.ComputeUIFields() + if atom.IsFuture { + t.Error("Task due in 6 days should not be IsFuture") + } + }) + + t.Run("8 days out is future", func(t *testing.T) { + tz := time.UTC + now := time.Now().In(tz) + eightDays := time.Date(now.Year(), now.Month(), now.Day()+8, 0, 0, 0, 0, tz) + atom := Atom{DueDate: &eightDays} + atom.ComputeUIFields() + if !atom.IsFuture { + t.Error("Task due in 8 days should be IsFuture") + } + }) + // Test with due date at midnight (no specific time) t.Run("midnight due date", func(t *testing.T) { now := time.Now() -- cgit v1.2.3