comment.go
1package bug
2
3import (
4 "github.com/dustin/go-humanize"
5 "time"
6)
7
8type Comment struct {
9 Author Person `json:"author"`
10 Message string `json:"message"`
11
12 // Creation time of the comment.
13 // Should be used only for human display, never for ordering as we can't rely on it in a distributed system.
14 UnixTime int64
15}
16
17func (c Comment) FormatTime() string {
18 t := time.Unix(c.UnixTime, 0)
19 return humanize.Time(t)
20}