diff options
| author | Grant Ammons <gammons@gmail.com> | 2017-03-03 18:40:42 -0500 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2017-03-06 07:52:02 -0500 |
| commit | f4fe01543efcf33b86d22eb34736b54fbf2da3c3 (patch) | |
| tree | 4196554e22e5c1c09102f54cee872eff7af8cb99 /todolist | |
| parent | be32789ec53ebe0a2141cf4d13696280ef79ee7f (diff) | |
Fix agenda bug
Previously, running `todo agenda` was also listing todos with no due date. Now, it won't do that.
Diffstat (limited to 'todolist')
| -rw-r--r-- | todolist/date_filter.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/todolist/date_filter.go b/todolist/date_filter.go index 2bf51e2..0575e6a 100644 --- a/todolist/date_filter.go +++ b/todolist/date_filter.go @@ -17,7 +17,7 @@ func NewDateFilter(todos []*Todo) *DateFilter { } func (f *DateFilter) FilterDate(input string) []*Todo { - agendaRegex, _ := regexp.Compile(`agenda .*$`) + agendaRegex, _ := regexp.Compile(`agenda.*$`) if agendaRegex.MatchString(input) { return f.filterAgenda(now.BeginningOfDay()) } @@ -57,6 +57,9 @@ func (f *DateFilter) filterAgenda(pivot time.Time) []*Todo { var ret []*Todo for _, todo := range f.Todos { + if todo.Due == "" { + continue + } dueTime, _ := time.ParseInLocation("2006-01-02", todo.Due, f.Location) if dueTime.Before(pivot) || todo.Due == pivot.Format("2006-01-02") { ret = append(ret, todo) |
