aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/util.go
diff options
context:
space:
mode:
authorIngo Richter <ingo.richter+github@gmail.com>2017-04-08 18:24:16 -0700
committerIngo Richter <ingo.richter+github@gmail.com>2017-04-08 18:24:16 -0700
commitd2df602c25afe3193e2b4d434042b47de64a00e6 (patch)
treedb5b17db8d45ff1a96a52fc8c15ded3713aa1c3e /todolist/util.go
parent146f19e1dc8143096bca6bfd0adf2e1f8d9be7b7 (diff)
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.
Diffstat (limited to 'todolist/util.go')
-rw-r--r--todolist/util.go4
1 files changed, 3 insertions, 1 deletions
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 {