I’m trying to set a post date in a site using casper theme.
In the casper theme code, I can see that the date is parsed using:
{{ page.date|date('F d. Y.') }}
So I assumed that setting the header of my post as the following would display the appropriate date in the post page. Instead, it’s displaying today’s date. So it seems it’s taking as date when I last modified the post’s markdown file.
----
template: item
title: Some blogpost
date: 2022-01-06
---
Please note that I have the appropriate date format in my config/system.yaml file:
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/ ), then the Americanm/d/y is assumed; whereas if the separator is a dash (- ) or a dot (. ), then the Europeand.m.y format is assumed.
Try one of the supported formats. Eg.:
---
template: item
title: Some blogpost
date: 06-01-2022
---
Hello @pamtbaau, thanks a lot for your answer.
Indeed trying the format you propose does work. I’ll consider using this workaround if there’s no alternative.
However I would expect that filling the system config dateformat the way I did, would allow me to use the date format it describes. It’s a bit confusing to me to be able to specify a default date format, but that the date I input is not used if I don’t use the standard grav date format.
It’s even stranger because the Y-m-d formatted date is recognized (which is not the case if I don’t set the dateformat.default config, in which case an error is thrown). It is recognized, but not used.
I’m a bit perplex with this issue. I think I’ll dig more into grav issue tracker and maybe post an issue there.