timeadd() function should accept "d" for days and possibly longer intervals.
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
I've searched GH issues for all open/closed referencing "timeadd" and found nothing matching this request.
#### Description
The timeadd() function should allow longer intervals to be specified. It is possible to say "60 days" by converting that into hours but a comment has to be left to make it clear why "1440h" was specified.
#### Use Case(s)
My specific use case was the deprecate_at parameter for the aws EBS builder:
deprecate_at = timeadd(timestamp(), "1440h") # 60d * 24h = 1440
While this works I believe it would be more clear as to intent if the duration added could be in days or months.
#### Potential configuration
I would suggest "d" for days and "M" or "mo" for months. ("d" is unused at the moment and "mo" might be more clear than the month/minute conflict of M vs m)
#### Potential References
https://developer.hashicorp.com/packer/docs/templates/hcl_templates/functions/datetime/timeadd
https://developer.hashicorp.com/packer/integrations/hashicorp/amazon/latest/components/builder/ebs
(search for deprecate_at)
Contributor guide
Research direction
Start with the timeadd() documentation and implementation, then inspect the deprecate_at example in the AWS EBS builder. Clarify whether day support alone or month support is in scope, including the proposed syntax and month/minute ambiguity. Done means the accepted interval behavior and the referenced usage are clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100