From fdb24fcc60c6ca0de411377576314e7f1c6c6df9 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Sun, 2 Jan 2022 20:37:40 -0500 Subject: [PATCH] only write TS on a todo if writeTS is set --- pttodo/todo.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }