Packer: wrong isotime output

Created on 7 May 2017  ยท  6Comments  ยท  Source: hashicorp/packer

Hello,
Maybe it's my fault and I don't understand the isotime format, but I have the following line in my template.json file:

"output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"1970-01-01\"}}.box"

The output looks like this:

Arch-Linux-x86_64-virtualbox-5970-05-05.box

Today is: 2017-05-07. So why is the isotime format so wrong?

Host-System is: Arch Linux x86_64
packer version is: v1.0.0

my template.json looks like this: https://paste.archlinux.de/yc668/

core question

Most helpful comment

Thanks this fixed it for me.. I thought I could insert every date and packer would try to apply the format with the format not with a magic date.

All 6 comments

Try changing it to {{isotime "2006-01-02"}}.

Thanks this fixed it for me.. I thought I could insert every date and packer would try to apply the format with the format not with a magic date.

I would be nice to have more explanation in documentation. Because I also thought than I can use any date, but it seems it's not true.

      "ami_name": "base {{isotime \"2000-01-01\"}}",

gives

==> amazon-ebs: Creating the AMI: base 26000-01-01
"ami_name": "base {{isotime \"2017-12-31\"}}",

gives

==> amazon-ebs: Creating the AMI: base 26017-126-21

What date should I enter in template?

EDIT. Oh, I see now. I need to use magic date...

yeah it's a bit confusing since we use go's time functions and they certainly blazed a trail on this one. Here's our docs on it for future reference: https://www.packer.io/docs/templates/engine.html#isotime-function-format-reference

Yes, I've read documentation. But missed uses the magic reference date. Maybe it's possible to use more 'human readable', something like 2000-12-31 24(12):01:59

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings