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

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

Closed
moorereason opened this issue Aug 23, 2017 · 1 comment · Fixed by #3870
Closed

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

moorereason opened this issue Aug 23, 2017 · 1 comment · Fixed by #3870
Assignees
Milestone

Comments

@moorereason
Copy link
Contributor

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
And with time.Duration with the convenient alias `duration`:

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

Fixes gohugoio#3828
bep added a commit to bep/hugo that referenced this issue Sep 8, 2017
And with time.Duration with the convenient alias `duration`:

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

Fixes gohugoio#3828
bep added a commit to bep/hugo that referenced this issue Sep 8, 2017
And with time.Duration with the convenient alias `duration`:

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

Fixes gohugoio#3828
@bep bep closed this as completed in #3870 Sep 9, 2017
bep added a commit that referenced this issue Sep 9, 2017
And with time.Duration with the convenient alias `duration`:

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

Fixes #3828
@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 Mar 15, 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