From e5c96eee886b086856db07534d800d8cf1b500fa Mon Sep 17 00:00:00 2001 From: bouncepaw Date: Thu, 21 Jan 2021 18:49:22 +0500 Subject: [PATCH] Display proper time on history pages --- history/information.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/history/information.go b/history/information.go index 82c0eb3..7bd55e4 100644 --- a/history/information.go +++ b/history/information.go @@ -146,13 +146,14 @@ func (rev *Revision) asHistoryEntry(hyphaName string) (html string) { %[4]s %[5]s -`, hyphaName, rev.timeHourMinute(), rev.Hash, rev.Message, author) +`, hyphaName, rev.timeToDisplay(), rev.Hash, rev.Message, author) } -// Return time like 13:42 -func (rev *Revision) timeHourMinute() string { +// Return time like mm-dd 13:42 +func (rev *Revision) timeToDisplay() string { + D := rev.Time.Day() h, m, _ := rev.Time.Clock() - return strconv.Itoa(h) + ":" + strconv.Itoa(m) + return fmt.Sprintf("%02d — %02d:%02d", D, h, m) } // This regex is wrapped in "". For some reason, these quotes appear at some time and we have to get rid of them.