diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-23 00:42:44 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-23 00:42:44 +0000 |
| commit | 6c767194d9470b368f8d337e0719795f235f683c (patch) | |
| tree | 9ffbef1dfa45add88a821877a2e6c8ceb94f52f8 /internal/handlers/timeline_logic.go | |
| parent | 8abc63efdbc0bb96cd6c9aa99d6e9166e0bcabae (diff) | |
fix: parse Todoist local datetimes, show near-future tasks, add undated tasks to timeline
- 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 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/timeline_logic.go')
| -rw-r--r-- | internal/handlers/timeline_logic.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/internal/handlers/timeline_logic.go b/internal/handlers/timeline_logic.go index adfa406..145e851 100644 --- a/internal/handlers/timeline_logic.go +++ b/internal/handlers/timeline_logic.go @@ -18,7 +18,7 @@ func BuildTimeline(ctx context.Context, s *store.Store, tasksClient api.GoogleTa var items []models.TimelineItem now := config.Now() - // 1. Fetch Tasks + // 1. Fetch Tasks (dated) tasks, err := s.GetTasksByDateRange(start, end) if err != nil { return nil, err @@ -42,6 +42,29 @@ func BuildTimeline(ctx context.Context, s *store.Store, tasksClient api.GoogleTa items = append(items, item) } + // 1b. Fetch undated Tasks — place in Today section + undatedTasks, err := s.GetUndatedTasks() + if err != nil { + log.Printf("Warning: failed to fetch undated tasks: %v", err) + } else { + for _, task := range undatedTasks { + item := models.TimelineItem{ + ID: task.ID, + Type: models.TimelineItemTypeTask, + Title: task.Content, + Time: now, + Description: task.Description, + URL: task.URL, + OriginalItem: task, + IsCompleted: task.Completed, + Source: "todoist", + IsAllDay: true, + } + item.ComputeDaySection(now) + items = append(items, item) + } + } + // 2. Fetch Meals - combine multiple items for same date+mealType meals, err := s.GetMealsByDateRange(start, end) if err != nil { |
