From ef4c2f61d8c599ac25b4f465ffa3bea9ca6ce1a3 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Wed, 18 Dec 2019 13:26:25 -0500 Subject: Use timestamp-format in msgviewer This allows the time to be displayed in a user-configurable way. Also localize the time in the message viewer as it is in the message list. --- widgets/msgviewer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'widgets') diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 6de729e..b573201 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -55,7 +55,7 @@ func NewMessageViewer(acct *AccountView, conf *config.AercConfig, func(header string) ui.Drawable { return &HeaderView{ Name: header, - Value: fmtHeader(msg, header), + Value: fmtHeader(msg, header, conf.Ui.TimestampFormat), } }, ) @@ -93,7 +93,7 @@ func NewMessageViewer(acct *AccountView, conf *config.AercConfig, return mv } -func fmtHeader(msg *models.MessageInfo, header string) string { +func fmtHeader(msg *models.MessageInfo, header string, timefmt string) string { switch header { case "From": return models.FormatAddresses(msg.Envelope.From) @@ -104,7 +104,7 @@ func fmtHeader(msg *models.MessageInfo, header string) string { case "Bcc": return models.FormatAddresses(msg.Envelope.Bcc) case "Date": - return msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM") + return msg.Envelope.Date.Local().Format(timefmt) case "Subject": return msg.Envelope.Subject default: -- cgit v1.2.3