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

Invalid lower case of cast params #5538

Closed
bep opened this issue Dec 18, 2018 · 4 comments · Fixed by #5541
Closed

Invalid lower case of cast params #5538

bep opened this issue Dec 18, 2018 · 4 comments · Fixed by #5541
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Dec 18, 2018

{{ $_x :=  $.Params.MyDate | time }}
{{ $_x.AddDate 1 0 0 }}

The above fails. See below for workaround.

@bep bep added this to the v0.53 milestone Dec 18, 2018
@bep bep self-assigned this Dec 18, 2018
@moorereason
Copy link
Contributor

@bep bep changed the title Check param tolower Invalid lower case of cast params Dec 19, 2018
@bep
Copy link
Member Author

bep commented Dec 19, 2018

A current workaround is to split the declaration in 2:

{{ $time := $.Params.MyDate }}
{{ $time = $time | time }}
PARAMS TIME: {{ $time.AddDate 1 0 0 }}

@bep
Copy link
Member Author

bep commented Dec 19, 2018

This also works:

{{ $time := $.Params.MyDate | time }}
{{ $time = $time.AddDate 0 1 0 }}
PARAMS TIME: {{ $time.Format "2006-01-02" }}

Which I guess is a more useful and normal construct.

bep added a commit to bep/hugo that referenced this issue Dec 19, 2018
bep added a commit to bep/hugo that referenced this issue Dec 19, 2018
bep added a commit to bep/hugo that referenced this issue Dec 19, 2018
@bep bep closed this as completed in #5541 Dec 19, 2018
bep added a commit that referenced this issue Dec 19, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants