add todo.triggered to indicate should be set to todo

master
Bel LaPointe 2021-12-31 16:16:38 -05:00
parent a4cfc77e0a
commit 76008647c8
1 changed files with 8 additions and 0 deletions

View File

@ -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)
}