From a4cfc77e0ab019520ac6235d70f33ab2ff76a49a Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 31 Dec 2021 16:16:22 -0500 Subject: [PATCH] use ts for tses, including in schedule --- pttodo/schedule.go | 2 +- pttodo/ts.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pttodo/schedule.go b/pttodo/schedule.go index 68cdd60..e4f0f2c 100644 --- a/pttodo/schedule.go +++ b/pttodo/schedule.go @@ -86,5 +86,5 @@ type scheduleDue int64 var scheduleDuePattern = regexp.MustCompile(`^[0-9]+$`) func (due scheduleDue) next(time.Time) (time.Time, error) { - return time.Unix(int64(due), 0), nil + return TS(due).time(), nil } diff --git a/pttodo/ts.go b/pttodo/ts.go index f33691d..556ecf0 100644 --- a/pttodo/ts.go +++ b/pttodo/ts.go @@ -7,6 +7,10 @@ import ( type TS int64 +func (ts TS) time() time.Time { + return time.Unix(int64(ts), 0) +} + func (ts TS) MarshalJSON() ([]byte, error) { v, err := ts.MarshalYAML() if err != nil {