aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Ammons <grant@pipelinedealsco.com>2016-09-15 07:32:57 -0400
committerGitHub <noreply@github.com>2016-09-15 07:32:57 -0400
commitaa0580af8066b030c720a20b5e79e98a53d1ec11 (patch)
treead456f29d82ee55dfe828ef8476310375894227e
parent832a27475b773e7a63cc0b582be8d7871de75dc3 (diff)
parent76339ade637cb71b49d1b61d83f59c2322ef3a9d (diff)
Merge pull request #8 from gammons/fix-today
bugfix - use 'tod' as shorthand for today
-rw-r--r--todolist/parser.go2
-rw-r--r--todolist/parser_test.go8
2 files changed, 9 insertions, 1 deletions
diff --git a/todolist/parser.go b/todolist/parser.go
index c0c9c3c..433cfc6 100644
--- a/todolist/parser.go
+++ b/todolist/parser.go
@@ -61,7 +61,7 @@ func (p *Parser) Due(input string, day time.Time) string {
switch res {
case "none":
return ""
- case "today":
+ case "today", "tod":
return now.BeginningOfDay().Format("2006-01-02")
case "tomorrow", "tom":
return now.BeginningOfDay().AddDate(0, 0, 1).Format("2006-01-02")
diff --git a/todolist/parser_test.go b/todolist/parser_test.go
index 44ce3f7..37a4910 100644
--- a/todolist/parser_test.go
+++ b/todolist/parser_test.go
@@ -59,6 +59,10 @@ func TestDueToday(t *testing.T) {
if todo.Due != now.BeginningOfDay().Format("2006-01-02") {
fmt.Println("Date is different", todo.Due, time.Now())
}
+ todo = parser.ParseNewTodo("do this thing with @bob and @mary due tod")
+ if todo.Due != now.BeginningOfDay().Format("2006-01-02") {
+ fmt.Println("Date is different", todo.Due, time.Now())
+ }
}
func TestDueTomorrow(t *testing.T) {
@@ -67,6 +71,10 @@ func TestDueTomorrow(t *testing.T) {
if todo.Due != now.BeginningOfDay().AddDate(0, 0, 1).Format("2006-01-02") {
fmt.Println("Date is different", todo.Due, time.Now())
}
+ todo = parser.ParseNewTodo("do this thing with @bob and @mary due tom")
+ if todo.Due != now.BeginningOfDay().AddDate(0, 0, 1).Format("2006-01-02") {
+ fmt.Println("Date is different", todo.Due, time.Now())
+ }
}
func TestDueSpecific(t *testing.T) {