From 67aae8f1b6430df4d915be3f192198b1312067c3 Mon Sep 17 00:00:00 2001 From: Rafael Dantas Justo Date: Thu, 9 Jul 2026 16:24:21 -0300 Subject: [PATCH] Enhancement: Add filters to list tasks by due date Allow filtering tasks that have the due before/after a specific date. --- projects/task.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/task.go b/projects/task.go index 21ec6f8..86acbf6 100644 --- a/projects/task.go +++ b/projects/task.go @@ -778,6 +778,13 @@ type TaskListRequestFilters struct { // specific date and time. CompletedBefore *time.Time + // DueAfter is an optional filter to retrieve tasks due after a specific date. + DueAfter *twapi.Date + + // DueBefore is an optional filter to retrieve tasks due before a specific + // date. + DueBefore *twapi.Date + // TagIDs is an optional list of tag IDs to filter tasks by tags. TagIDs []int64 @@ -838,6 +845,12 @@ func (t TaskListRequestFilters) apply(req *http.Request) { if t.CompletedBefore != nil && !t.CompletedBefore.IsZero() { query.Set("completedBefore", t.CompletedBefore.Format(time.RFC3339)) } + if t.DueAfter != nil && !t.DueAfter.IsZero() { + query.Set("dueAfter", t.DueAfter.String()) + } + if t.DueBefore != nil && !t.DueBefore.IsZero() { + query.Set("dueBefore", t.DueBefore.String()) + } if len(t.TagIDs) > 0 { tagIDs := make([]string, len(t.TagIDs)) for i, id := range t.TagIDs {