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 · 3 comments

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Copy link
Contributor

moorereason commented Dec 18, 2018

@bep bep removed the NeedsInvestigation label Dec 19, 2018

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

@bep

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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 in #5541 Dec 19, 2018

bep added a commit that referenced this issue Dec 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment