use unix timestamp for inv created & usedBy

usedBy is still stored as a string in invites.json to cope with existing
invites with times stored formatted. knz/strtime requires cgo for
strptime, so it has been replaced with the native itchyny/timefmt-go.
This commit is contained in:
Harvey Tindall
2021-04-06 21:25:44 +01:00
parent 6ec2186bdf
commit 3f8414c70a
9 changed files with 77 additions and 60 deletions
+3 -3
View File
@@ -19,8 +19,8 @@ import (
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/html"
"github.com/itchyny/timefmt-go"
jEmail "github.com/jordan-wright/email"
"github.com/knz/strtime"
"github.com/mailgun/mailgun-go/v4"
)
@@ -101,8 +101,8 @@ type Email struct {
}
func (emailer *Emailer) formatExpiry(expiry time.Time, tzaware bool, datePattern, timePattern string) (d, t, expiresIn string) {
d, _ = strtime.Strftime(expiry, datePattern)
t, _ = strtime.Strftime(expiry, timePattern)
d = timefmt.Format(expiry, datePattern)
t = timefmt.Format(expiry, timePattern)
currentTime := time.Now()
if tzaware {
currentTime = currentTime.UTC()