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.
This commit is contained in:
Ben Burwell 2019-12-18 13:26:25 -05:00 committed by Reto Brunner
parent 4ab82bf306
commit ef4c2f61d8
1 changed files with 3 additions and 3 deletions

View File

@ -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: