Posted date on pages showing January 1, 0001

I have seen some issues about this problem dated in 2019 for version 55. It is now December 2022 and I am using hugo v0.104.2 which is giving me the same error now so whenever it was fixed back in 2019 it has come back in 2022.

Has it been corrected again and if so how do I apply it to my code?


You’d increase your chances of getting an answer if you provided the relevant code. Links to GitHub repositories are what most people are asking for here.

The date format in your page is invalid or missing I imagine.

There are three reasons this could happen:

  1. Front matter doesn’t contain a date value

  2. Front matter date is a string and its format is invalid (as noted by @nternetinspired)

  3. In your template you’ve done this:

    {{ .Date.Format "January 1, 2001" }}

    Instead of this:

    {{ .Date.Format "January 2, 2006" }}
1 Like

What is the valid format?
In my config.yaml I have “dateFormat: Mon Jan 2 2006” without the quotes and in my *.md file I have date: 2021-03-09 in the front matter.

When I view the file it shows “Posted January 1, 0001”

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.


Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

After doing much research on the Internet because I did not receive a see a valid response on this site I tried a number of things I found there. The next day my problem was solved and now I get valid dates on my posts.