1package bug
2
3import (
4 "github.com/MichaelMure/git-bug/util/git"
5 "github.com/dustin/go-humanize"
6)
7
8// Comment represent a comment in a Bug
9type Comment struct {
10 Author Person
11 Message string
12 Files []git.Hash
13
14 // Creation time of the comment.
15 // Should be used only for human display, never for ordering as we can't rely on it in a distributed system.
16 UnixTime Timestamp
17}
18
19// FormatTimeRel format the UnixTime of the comment for human consumption
20func (c Comment) FormatTimeRel() string {
21 return humanize.Time(c.UnixTime.Time())
22}
23
24func (c Comment) FormatTime() string {
25 return c.UnixTime.Time().Format("Mon Jan 2 15:04:05 2006 +0200")
26}
27
28// Sign post method for gqlgen
29func (c Comment) IsAuthored() {}