diff options
Diffstat (limited to 'bug')
-rw-r--r-- | bug/comment.go | 6 | ||||
-rw-r--r-- | bug/snapshot.go | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/bug/comment.go b/bug/comment.go index 09cd49bd..8ea4154f 100644 --- a/bug/comment.go +++ b/bug/comment.go @@ -1,5 +1,7 @@ package bug +import "time" + type Comment struct { Author Person Message string @@ -8,3 +10,7 @@ type Comment struct { // Should be used only for human display, never for ordering as we can't rely on it in a distributed system. Time int64 } + +func (c Comment) FormatTime() string { + return time.Unix(c.Time, 0).Format(time.RFC822) +} diff --git a/bug/snapshot.go b/bug/snapshot.go index 41d96aa2..9229e7a1 100644 --- a/bug/snapshot.go +++ b/bug/snapshot.go @@ -33,6 +33,9 @@ func (snap Snapshot) Summary() string { } func (snap Snapshot) LastEdit() time.Time { + if len(snap.Comments) == 0 { + return time.Unix(0, 0) + } lastEditTimestamp := snap.Comments[len(snap.Comments)-1].Time return time.Unix(lastEditTimestamp, 0) } |