Properly document dateformat function

The docs for dateformat omit something essential; the string that specifies the format has to refer to the second of january in the year 2006.

A quick search on dateformat on this discourse shows that I am not the only one who bumped into this issue, which is very frustrating because no error is given, even if the dateformat output gives nonsensical results such as it being the year 9000.

Please modify the page to say this.

P.S. Does anyone know how the dateformat function disambiguates the 2 in the year from the 2 which is the day? Is it just not possible to have a date formatted as [day] [month] '[year] millenium 2 century 0 or similar?

The page for dateformat (https://gohugo.io/functions/dateformat/) links to .Format (https://gohugo.io/functions/format/) which links to https://golang.org/pkg/time/ which explains it all.

Feel free to add a pull request on the documentation repository to add a link to Golang’s date formatting on dateformat itself. It’s weird, I know, but that’s how Golang does dates (not Hugo, but Hugo using Golang).

Okay. https://github.com/gohugoio/hugoDocs/pull/1176

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.