aboutsummaryrefslogtreecommitdiffstats
path: root/todolist
diff options
context:
space:
mode:
authorStuart Skelton <stuarts@broadbean.com>2017-07-20 00:02:12 +0100
committerStuart Skelton <stuarts@broadbean.com>2017-07-20 00:02:12 +0100
commit29242153da9632b1decef8491fc5549719c85d7b (patch)
treec194598b041291e0f6bf6192ffa53898331b650b /todolist
parent024696b7751757d74096214d22a0bf013a9c881f (diff)
Added filterToExactDate.
Filters the todolist to a certain date.
Diffstat (limited to 'todolist')
-rw-r--r--todolist/date_filter.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/todolist/date_filter.go b/todolist/date_filter.go
index 8d64484..13c3705 100644
--- a/todolist/date_filter.go
+++ b/todolist/date_filter.go
@@ -68,7 +68,7 @@ func (f *DateFilter) filterAgenda(pivot time.Time) []*Todo {
return ret
}
-func (f *DateFilter) filterToday(pivot time.Time) []*Todo {
+func (f *DateFilter) filterToExactDate(pivot time.Time) []*Todo {
var ret []*Todo
for _, todo := range f.Todos {
if todo.Due == pivot.Format("2006-01-02") {
@@ -78,6 +78,11 @@ func (f *DateFilter) filterToday(pivot time.Time) []*Todo {
return ret
}
+
+func (f *DateFilter) filterToday(pivot time.Time) []*Todo {
+ return f.filterToExactDate(pivot)
+}
+
func (f *DateFilter) filterDay(pivot time.Time, day time.Weekday) []*Todo {
var ret []*Todo
filtered := f.filterThisWeek(pivot)
@@ -92,14 +97,8 @@ func (f *DateFilter) filterDay(pivot time.Time, day time.Weekday) []*Todo {
}
func (f *DateFilter) filterTomorrow(pivot time.Time) []*Todo {
- var ret []*Todo
pivot = pivot.AddDate(0, 0, 1)
- for _, todo := range f.Todos {
- if todo.Due == pivot.Format("2006-01-02") {
- ret = append(ret, todo)
- }
- }
- return ret
+ return f.filterToExactDate(pivot)
}
func (f *DateFilter) filterThisWeek(pivot time.Time) []*Todo {