Date field request
jwnetwerk opened this issue · 2 comments
Hi,
You have created a ID and TodayID field, but I'm looking to only a date field when the report is running.
Is it possible to also create a Today field that only gives Y-M-D without any other information?
This way I can create from the config file a path like:
{{.Today}}/{{.PolicyPublished.Domain}}/{{.ReportMetadata.OrgName}}/index.html
That will result in:
2022-3-2/domain.com/google.com/index.html
Thanks.
I added function "now" to the master branch which can be used inside templates. First argument - golang datetime format
In your case it will be
output:
file: '{{ now "2006-2-1" }}/{{.PolicyPublished.Domain}}/{{.ReportMetadata.OrgName}}/index.html'
I tried the line specified above. This gives the error:
panic: template: filename:1: function "now" not defined
goroutine 1 [running]:
html/template.Must(...)
/opt/hostedtoolcache/go/1.13.15/x64/src/html/template/template.go:372
main.loadConfig(0x7ffd72018763, 0xd, 0x2, 0x2, 0x0)
/home/runner/work/dmarc-report-converter/dmarc-report-converter/cmd/dmarc-report-converter/config.go:103 +0x5fc
main.main()
/home/runner/work/dmarc-report-converter/dmarc-report-converter/cmd/dmarc-report-converter/main.go:30 +0x1a6[ERROR] loadConfig: yaml: line 20: did not find expected key