aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-17 20:51:09 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-17 20:51:09 +0200
commit43bf0063f2994463cdb98ec6420b786ca41dde28 (patch)
tree5a2c29ac37635d1cb6b020d7ce7f51849c42fc26 /bug
parent1332a6ec0a00b2475bc2b7b35b4c61425361d6b6 (diff)
downloadgit-bug-43bf0063f2994463cdb98ec6420b786ca41dde28.tar.gz
crude implementation of show
Diffstat (limited to 'bug')
-rw-r--r--bug/comment.go6
-rw-r--r--bug/snapshot.go3
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)
}