From d2df602c25afe3193e2b4d434042b47de64a00e6 Mon Sep 17 00:00:00 2001 From: Ingo Richter Date: Sat, 8 Apr 2017 18:24:16 -0700 Subject: Add `CompletedDate` to todo item. `CompletedDate` will save a timestamp in ISO8601 format (Internet date/ time format to preserve timezone information) Added a new `Complete` and `Uncomplete` method for todo_item. Currently a todo has a boolean flag and the timestamp to indicate that the item is completed. The boolean flag could be kept for backward compatibility (reading the json into memory), but should be omitted for files being written. --- todolist/util.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'todolist/util.go') diff --git a/todolist/util.go b/todolist/util.go index 72d475f..b87ed03 100644 --- a/todolist/util.go +++ b/todolist/util.go @@ -32,7 +32,9 @@ func AddTodoIfNotThere(arr []*Todo, item *Todo) []*Todo { func bod(t time.Time) time.Time { year, month, day := t.Date() - return time.Date(year, month, day, 0, 0, 0, 0, t.Location()) + hour, min, sec := t.Clock() + + return time.Date(year, month, day, hour, min, sec, 0, t.Location()) } func getNearestMonday(t time.Time) time.Time { -- cgit v1.3