Skip to content

Date strings interpreted as timestamp #301

Description

@thegoodlittlescript

Describe the bug

Date strings are interpreted as timestamps. This behavior doesn't seem to be avoidable.

To Reproduce

Make a template that is supposed to substitute a date string. For example ./example/file.txt:

The date is: {{ .THEDATE }}

Run boilerplate:

boilerplate --version
# boilerplate version v0.14.0
boilerplate --template-url ./example --output-folder ./output --var THEDATE="$(date +%Y-%m-%d)"

Then check the output/file.txt. It will have content like:

The date is: 2026-03-26 00:00:00 +0000 UTC

I tried declaring the variable as a string in boilerplate.yml like:

variables:
  - name: THEDATE
    type: string

That produced an error:

boilerplate --template-url ./example --output-folder ./output --var THEDATE="$(date +%Y-%m-%d)"
# [boilerplate] 2026/03/26 02:11:29 Loading boilerplate config from example/boilerplate.yml
# [boilerplate] 2026/03/26 02:11:29 Loading boilerplate config from example/boilerplate.yml
# ERROR: Value '2026-03-26 00:00:00 +0000 UTC' is not a valid value for variable 'THEDATE' with type 'string'

Expected behavior

I expect the output content to be like:

The date is: 2026-03-26

I think this should be the default behavior (simply assume everything is a string). Additionally if the variable is specifically declared as a string then it should be treated as a string.

Nice to have

  • Terminal output
  • Screenshots

Additional context

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions