summaryrefslogtreecommitdiff
path: root/internal/api/google_tasks.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/google_tasks.go')
-rw-r--r--internal/api/google_tasks.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/api/google_tasks.go b/internal/api/google_tasks.go
index 77a00ed..ecacb6d 100644
--- a/internal/api/google_tasks.go
+++ b/internal/api/google_tasks.go
@@ -123,23 +123,26 @@ func (c *GoogleTasksClient) getTasksFromList(ctx context.Context, listID string)
return result, nil
}
-// GetTasksByDateRange fetches tasks with due dates in the specified range
+// GetTasksByDateRange fetches tasks with due dates in the specified range.
+// Tasks without due dates are included and treated as "today" tasks.
func (c *GoogleTasksClient) GetTasksByDateRange(ctx context.Context, start, end time.Time) ([]models.GoogleTask, error) {
allTasks, err := c.GetTasks(ctx)
if err != nil {
return nil, err
}
- // Filter by date range
+ startDay := time.Date(start.Year(), start.Month(), start.Day(), 0, 0, 0, 0, c.displayTZ)
+ endDay := time.Date(end.Year(), end.Month(), end.Day(), 0, 0, 0, 0, c.displayTZ)
+
+ // Filter by date range, include tasks without due dates
var filtered []models.GoogleTask
for _, task := range allTasks {
if task.DueDate == nil {
+ // Include tasks without due dates (they'll be shown in "today" section)
+ filtered = append(filtered, task)
continue
}
dueDay := time.Date(task.DueDate.Year(), task.DueDate.Month(), task.DueDate.Day(), 0, 0, 0, 0, c.displayTZ)
- startDay := time.Date(start.Year(), start.Month(), start.Day(), 0, 0, 0, 0, c.displayTZ)
- endDay := time.Date(end.Year(), end.Month(), end.Day(), 0, 0, 0, 0, c.displayTZ)
-
if !dueDay.Before(startDay) && dueDay.Before(endDay) {
filtered = append(filtered, task)
}