Specific date formatting in frontmatter

Hi

My archetype (yaml) has:

date: '{{ .Date | time.Format ":date_medium" }}'

And it generates a .md file that has :

date: 'Apr 6, 2024'

In my .html file, I’m using it like: {{ .Date }}

Instead of getting Apr 6, 2024, I get 0001-01-01 00:00:00 +0000 UTC . I’m assuming hugo tried re-formatting the date , and couldn’t so it just defaulted to that date

If I change the date to 2024-02-09 and change my .html file to be: {{ .Date | time.Format ":date_medium" }}, everything works as expected.

But, I want to explicitly have this format Apr 6, 2024 in my front matter because it’s clear and I don’t have to spend an extra 2 seconds figuring out what the month or day is.

Any way to go about this?

Thanks

No.

See “Examples of parsable string representations” here:
https://gohugo.io/functions/time/format/

Bummer, thanks for the reply