Implement {when_iso_local} placeholder (#2363)

Implement `{when_iso_local}` placeholder

This implements the `{when_iso_local}` placeholder. This is like the
`{when_iso}` placeholder but the output is in the current timezone
rather than UTC.

Resolves #2362
This commit is contained in:
Kurtis Rader
2018-12-18 14:42:05 -08:00
committed by Toby Allen
parent 1570bc5d03
commit 0684cf8611
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -368,6 +368,8 @@ func (r *replacer) getSubstitution(key string) string {
return url.QueryEscape(r.request.URL.RequestURI())
case "{when}":
return now().Format(timeFormat)
case "{when_iso_local}":
return now().Format(timeFormatISO)
case "{when_iso}":
return now().UTC().Format(timeFormatISOUTC)
case "{when_unix}":
@@ -539,6 +541,7 @@ func (r *replacer) Set(key, value string) {
const (
timeFormat = "02/Jan/2006:15:04:05 -0700"
timeFormatISO = "2006-01-02T15:04:05" // ISO 8601 with timezone to be assumed as local
timeFormatISOUTC = "2006-01-02T15:04:05Z" // ISO 8601 with timezone to be assumed as UTC
headerContentType = "Content-Type"
contentTypeJSON = "application/json"