about summary refs log tree commit diff stats
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-12-18 13:26:25 -0500
committerReto Brunner <reto@labrat.space>2019-12-19 08:45:26 +0100
commitef4c2f61d8c599ac25b4f465ffa3bea9ca6ce1a3 (patch)
tree467615ca00d868c387c61c74c026418cf75d45da /widgets/msgviewer.go
parent4ab82bf306370ae4d79c12f5028a51b38fe40547 (diff)
downloadaerc-ef4c2f61d8c599ac25b4f465ffa3bea9ca6ce1a3.tar.gz
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.
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go6
1 files changed, 3 insertions, 3 deletions
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: