~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] toLocal template function

Details
Message ID
<20200224233819.2876618-1-somebody@froghat.ca>
DKIM signature
missing
Download raw message
Patch: +6 -1
Hi. This adds a template function to convert a time to the local time zone. And modifies
the default quoted_reply template to use it and show the time zone when formatting the
timestamp of the quoted message.

Previously, the quoted message timestamp was UTC and it would format it without the time
zone. And I thought it might be a little confusing or weird to some normal people when I
email them and I don't want normal people to be confused or think that I'm weird.

---
 lib/templates/template.go | 5 +++++
 templates/quoted_reply    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/templates/template.go b/lib/templates/template.go
index f2765e8..9df594e 100644
--- a/lib/templates/template.go
+++ b/lib/templates/template.go
@@ -156,11 +156,16 @@ func cmd(cmd, text string) string {
	return out.String()
}

func toLocal(t time.Time) time.Time {
	return time.Time.In(t, time.Local)
}

var templateFuncs = template.FuncMap{
	"quote":      quote,
	"wrapText":   wrapText,
	"wrap":       wrap,
	"dateFormat": time.Time.Format,
	"toLocal":    toLocal,
	"exec":       cmd,
}

diff --git a/templates/quoted_reply b/templates/quoted_reply
index f22c2f3..64db1b5 100644
--- a/templates/quoted_reply
+++ b/templates/quoted_reply
@@ -1,2 +1,2 @@
On {{dateFormat .OriginalDate "Mon Jan 2, 2006 at 3:04 PM"}}, {{(index .OriginalFrom 0).Name}} wrote:
On {{dateFormat (.OriginalDate | toLocal) "Mon Jan 2, 2006 at 3:04 PM PST"}}, {{(index .OriginalFrom 0).Name}} wrote:
{{wrapText .OriginalText 72 | quote }}
-- 
2.24.1
Details
Message ID
<C7D4709A-73CD-4735-A1F6-D1CE6B7BAA8A@labrat.space>
In-Reply-To
<20200224233819.2876618-1-somebody@froghat.ca> (view parent)
DKIM signature
pass
Download raw message
Hi,
Thanks for the patch, less weird sounds good ;P

Can you please update the manpage accordingly?
Having good documentation is kinda important for people to find the functionality.

Greetings,
Reto
Details
Message ID
<C0VDGK44PJUE.2P0OY6P0SYE6K@homura>
In-Reply-To
<20200224233819.2876618-1-somebody@froghat.ca> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/aerc
   1455ad9..2fcd77f  master -> master
Reply to thread Export thread (mbox)