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

tpl: Add ability to turn integer into a time.Duration #3828

Closed
moorereason opened this Issue Aug 23, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@moorereason
Contributor

moorereason commented Aug 23, 2017

We should provide a way to turn an integer into a time.Duration.

{{ $dur := time.Duration (mul time.Second $secs) }}

Will likely need Hour, Minute, Second, Microsecond, and Millisecond constants, as well.

See https://discourse.gohugo.io/t/replacing-existing-js-array-with-a-static-template/8051/5

@moorereason moorereason added this to the v0.27 milestone Aug 23, 2017

@bep bep modified the milestones: v0.27, v0.28 Sep 7, 2017

@bep bep self-assigned this Sep 8, 2017

bep added a commit to bep/hugo that referenced this issue Sep 8, 2017

tpl/time: Add time.Duration and time.ParseDuration template funcs
And with time.Duration with the convenient alias `duration`:

```
{{ mul 60 60 | duration "second" }}
```

Fixes #3828

bep added a commit to bep/hugo that referenced this issue Sep 8, 2017

tpl/time: Add time.Duration and time.ParseDuration template funcs
And with time.Duration with the convenient alias `duration`:

```
{{ mul 60 60 | duration "second" }}
```

Fixes #3828

bep added a commit to bep/hugo that referenced this issue Sep 8, 2017

tpl/time: Add time.Duration and time.ParseDuration template funcs
And with time.Duration with the convenient alias `duration`:

```
{{ mul 60 60 | duration "second" }}
```

Fixes #3828

@bep bep closed this in #3870 Sep 9, 2017

bep added a commit that referenced this issue Sep 9, 2017

tpl/time: Add time.Duration and time.ParseDuration template funcs
And with time.Duration with the convenient alias `duration`:

```
{{ mul 60 60 | duration "second" }}
```

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