diff options
| author | Grant Ammons <gammons@gmail.com> | 2016-05-12 08:35:01 -0400 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2016-05-12 08:35:01 -0400 |
| commit | ef1512dad650f6f2afc5499df1215f9e855a1786 (patch) | |
| tree | b0c496288ee2daec4300c9fad69351e36cb9c525 | |
| parent | 3f14a184e28927697185d35829fa1bdb9db5b80d (diff) | |
Ensure agenda works with other input
| -rw-r--r-- | todolist/date_filter.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/todolist/date_filter.go b/todolist/date_filter.go index 404e0b1..a502d62 100644 --- a/todolist/date_filter.go +++ b/todolist/date_filter.go @@ -1,7 +1,6 @@ package todolist import ( - "fmt" "regexp" "time" @@ -17,12 +16,12 @@ func NewDateFilter(todos []*Todo) *DateFilter { } func (f *DateFilter) FilterDate(input string) []*Todo { - if input == "agenda" { - fmt.Println("input IS agenda") + agendaRegex, _ := regexp.Compile(`agenda .*$`) + if agendaRegex.MatchString(input) { return f.filterAgenda(now.BeginningOfDay()) } - r, _ := regexp.Compile(`due .*$`) + r, _ := regexp.Compile(`due .*$`) match := r.FindString(input) switch { case match == "due tod" || match == "due today": |
