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

import (
	"github.com/dustin/go-humanize"
	"time"
)

type Comment struct {
	Author  Person `json:"author"`
	Message string `json:"message"`

	// 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
}

func (c Comment) FormatTime() string {
	t := time.Unix(c.UnixTime, 0)
	return humanize.Time(t)
}