diff --git a/pttodo/todo.go b/pttodo/todo.go index dafce6e..a7d99ee 100644 --- a/pttodo/todo.go +++ b/pttodo/todo.go @@ -7,11 +7,12 @@ import ( type Todo struct { Todo string - TS TS Details string `yaml:",omitempty"` Schedule Schedule `yaml:",omitempty"` Tags string `yaml:",omitempty"` Subtasks []Todo `yaml:",omitempty"` + TS TS `yaml:",omitempty"` + writeTS bool } func (todo Todo) Triggered() bool { @@ -21,6 +22,11 @@ func (todo Todo) Triggered() bool { } func (todo Todo) MarshalYAML() (interface{}, error) { + if !todo.writeTS { + todo.TS = 0 + } else { + todo.TS = TS(todo.TS.time().Unix()) + } if fmt.Sprint(todo) == fmt.Sprint(Todo{Todo: todo.Todo}) { return todo.Todo, nil }