Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYYY-MM-DD formatted date in header doesn't work but "YYYY-MM-DD" and DD-MM-YYYY do #3812

Open
eauchat opened this issue Apr 1, 2024 · 2 comments

Comments

@eauchat
Copy link

eauchat commented Apr 1, 2024

I've read quite a bunch of issues related to date format and some of them relate to the issue I'm having, but I've seen no proper answer to the problem. Please feel welcome to correct me if I'm wrong.

More details on the issue are visible here.

After more investigations, here is the situation:
with the following in config/system.yaml:

dateformat:
    default: Y-m-d
    short: Y-m-d
    long: Y-m-d_H:i

The following date headers will make the post display the appropriate date:

date: 06-01-2022

or

date: "2022-01-06"

but

date: 2022-01-06

won't, it will display today's date instead (or maybe the date the markdown file has been saved).

Seems like a bug to me. But maybe there is an explanation.
It's not a big deal, but not so straightforward to understand why something is not working for users, so may be worth addressing.

Apart from that, thanks a lot for grav, it's amazing :) :) :)

@pamtbaau
Copy link
Contributor

pamtbaau commented Apr 9, 2024

Try the following format in system,yaml to allow the use of date without quotes:

pages:
  dateformat:
    default: U

When the header is processed, the date value is in unixepoch format.

@eauchat
Copy link
Author

eauchat commented Apr 14, 2024

Thanks for telling me about this workaround @pamtbaau .
Personally, I still think it'd be worth fixing in grav, so that it's more straightforward for users not to encounter this weird behaviour when having/not having quotes. But I don't know how easy it is to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants