diff options
| -rw-r--r-- | todo.go | 2 | ||||
| -rw-r--r-- | todolist/date_filter.go | 13 |
2 files changed, 4 insertions, 11 deletions
@@ -11,7 +11,7 @@ import ( ) const ( - VERSION = "0.6" + VERSION = "0.7" ) func main() { diff --git a/todolist/date_filter.go b/todolist/date_filter.go index b91bee3..261e5ad 100644 --- a/todolist/date_filter.go +++ b/todolist/date_filter.go @@ -112,16 +112,9 @@ func (f *DateFilter) filterCompletedToday(pivot time.Time) []*Todo { } func (f *DateFilter) filterDay(pivot time.Time, day time.Weekday) []*Todo { - var ret []*Todo - filtered := f.filterThisWeek(pivot) - for _, todo := range filtered { - dueTime, _ := time.ParseInLocation("2006-01-02", todo.Due, f.Location) - if dueTime.Weekday() == day { - ret = append(ret, todo) - } - - } - return ret + thisWeek := NewDateFilter(f.filterThisWeek(pivot)) + pivot = f.FindSunday(pivot).AddDate(0, 0, int(day)) + return thisWeek.filterToExactDate(pivot, filterOnDue) } func (f *DateFilter) filterBetweenDatesInclusive(begin, end time.Time, filterOn func(*Todo) string) []*Todo { |
