diff options
| author | Grant Ammons <gammons@gmail.com> | 2017-03-06 07:57:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-06 07:57:22 -0500 |
| commit | 7e50f18e5ed99abb58d3235b0060fc11ba9aa83d (patch) | |
| tree | da4976fbd151164a14317dd4d0ee5a1f96d7fb79 /todolist | |
| parent | c67037d4944c949bd53e2a0925a51717c7eb5334 (diff) | |
| parent | f4fe01543efcf33b86d22eb34736b54fbf2da3c3 (diff) | |
Merge pull request #39 from gammons/agenda-bugfix
Fix agenda bug
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) |
