How to change the format of dates in a page

I can not find how to set the correct Date format for published pages / blog items.

I want to set date first - followed by month…

I have done all I could to set the Default Date settings both in app and after in settings.yml , nothing changed…

Then I went into particular Page settings - there is an option to set Date… but there is a popup javascript calendar - which it seems support only 1 date format - May 22, 2022; No way I can force it to set & display 22 May 2022

As a last resort - I was trying to modify date format in .md files themselves - but no luck… whatever I write there - it interprets in American manner…

so I need 22 May 2022 , instead of May 22 2022 …

Also - I would be happy about 24h clock format, I never got it…

I am trying to use Bootstrap 4 theme, which I yesterday downloded, I am 2 day on this Grav…

p.s. as a sidenote - could you change the Avatars, so it won’t show the Z sign on my avatar?! Lately Z symbol stands for Russian invasion in Ukraine, it is forbidden in several countries in Europe now…

@zambala, The date format is often set in the template.

Quark:
In Quark /templates/partials/blog/date.html.blog the date output is formatted as follows:

{{ page.date|date(system.pages.dateformat.short) }}

Note, the |date filter uses the dateformat as set in system.yaml.

The default format that comes with Grav in system.yaml is:

pages:
  dateformat:
    default:                                     # The default date format Grav expects in the `date: ` field
    short: 'jS M Y'                              # Short date format
    long: 'F jS \a\t g:ia'                       # Long date format

Which will display the date as 11th Aug 2017. See PHP DateTime formats.

Bootstrap4:
Bootstrap 4 uses another way to output the dates: See /templates/partials/blog_item.html.twig line 23

{{ page.date|date("F j, Y, g:i a") }}

As you can see, the output format is hardcoded as August 11, 2017, 2:55 pm. No matter what you set, the display of the date will remain the same.

Solution:
Create a child theme of Bootstrap 4 and change template blog_item.html.twig to your liking.

Avatar:
You can provide your own in your profile.

1 Like

Thanks, the Item template date seems working…

Since you’re editing templates anyway, you could check also my Translate Date plugin :wink:

1 Like