diff options
Diffstat (limited to 'todolist')
| -rw-r--r-- | todolist/todo_item.go | 2 | ||||
| -rw-r--r-- | todolist/util.go | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/todolist/todo_item.go b/todolist/todo_item.go index c208f9f..859e946 100644 --- a/todolist/todo_item.go +++ b/todolist/todo_item.go @@ -37,7 +37,7 @@ func (t Todo) CalculateDueTime() time.Time { func (t *Todo) Complete() { t.Completed = true - t.CompletedDate = bod(time.Now()).Format(ISO8601_TIMESTAMP_FORMAT) + t.CompletedDate = timestamp(time.Now()).Format(ISO8601_TIMESTAMP_FORMAT) } func (t *Todo) Uncomplete() { diff --git a/todolist/util.go b/todolist/util.go index b87ed03..34f9dd1 100644 --- a/todolist/util.go +++ b/todolist/util.go @@ -32,6 +32,12 @@ 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()) +} + +func timestamp(t time.Time) time.Time { + year, month, day := t.Date() hour, min, sec := t.Clock() return time.Date(year, month, day, hour, min, sec, 0, t.Location()) |
