aboutsummaryrefslogtreecommitdiffstats
path: root/bug/comment.go
blob: ef5d9ef7f70d74640c415f795e078cca2e6f7fd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package bug

import (
	"github.com/MichaelMure/git-bug/util"
	"github.com/dustin/go-humanize"
	"time"
)

// Comment represent a comment in a Bug
type Comment struct {
	Author  Person
	Message string
	Files   []util.Hash

	// Creation time of the comment.
	// Should be used only for human display, never for ordering as we can't rely on it in a distributed system.
	UnixTime int64
}

// FormatTime format the UnixTime of the comment for human consumption
func (c Comment) FormatTime() string {
	t := time.Unix(c.UnixTime, 0)
	return humanize.Time(t)
}