diff --git a/pttodo/todo.go b/pttodo/todo.go index 9eb3f57..bede663 100644 --- a/pttodo/todo.go +++ b/pttodo/todo.go @@ -1,8 +1,16 @@ package pttodo +import "time" + type Todo struct { Todo string Detail string `yaml:",omitempty"` TS TS `yaml:",omitempty"` Schedule Schedule `yaml:",omitempty"` } + +func (todo Todo) Triggered() bool { + last := todo.TS + next, err := todo.Schedule.Next(last.time()) + return err == nil && time.Now().After(next) +}