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/todo_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'todolist/todo_test.go') diff --git a/todolist/todo_test.go b/todolist/todo_test.go index aab2a74..c0069e6 100644 --- a/todolist/todo_test.go +++ b/todolist/todo_test.go @@ -5,7 +5,7 @@ import "testing" func TestNewTodo(t *testing.T) { todo := NewTodo() - if todo.Completed || todo.Archived { + if todo.Completed || todo.Archived || todo.CompletedDate != "" { t.Error("Completed should be false for new todos") } } -- cgit v1.3