Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date field request #23

Closed
jwnetwerk opened this issue Feb 3, 2022 · 2 comments
Closed

Date field request #23

jwnetwerk opened this issue Feb 3, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@jwnetwerk
Copy link

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.

@tierpod tierpod added the enhancement New feature or request label Feb 3, 2022
@tierpod tierpod closed this as completed in 14dbe3e Feb 3, 2022
@tierpod
Copy link
Owner

tierpod commented Feb 3, 2022

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'

@jwnetwerk
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants