show commit time in log as a human-readable, relative time
1 file changed, 2 insertions(+), 1 deletion(-)
jump to
M templates/commit.go → templates/commit.go
@@ -5,6 +5,7 @@ "fmt" "time" "github.com/bluekeyes/go-gitdiff/gitdiff" + "github.com/dustin/go-humanize" "github.com/go-git/go-git/v5/plumbing/object" "go.alanpearce.eu/elgit/git" g "go.alanpearce.eu/gomponents"@@ -119,7 +120,7 @@ ), Div( Time( DateTime(author.When.Format(time.RFC3339)), - g.Text(author.When.Format("Mon, 02 Jan 2006 15:04:05 -0700")), + g.Text(humanize.Time(author.When)), ), ), )