Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Date format

Started by Muut Archive 11 years ago · 9 replies · 2581 views
11 years ago

I use a date format of YYYY-MM-DD. Is there an easy way to accomplish this currently? If not, I'll add a configuration option to set the date format.

11 years ago

Where are you looking to use this date format? in the filename? for the date of the page?

11 years ago

Under admin - options - publishing, the date is currently '01-09-2014 14:55'. This translates to the the page.md yaml file having a line of 'date: '01-09-2014 14:55'.

11 years ago

Forward slash (/) signifies American M/D/Y formatting, a dash (-) signifies European D-M-Y and a period (.) signifies ISO Y.M.D.

So you can use YYYY.MM.DD for date:, but if you save it directly in expert mode. The admin is storing dates in the european format. Currently that is not configurable, but probably could be a configuration option.

Please submit an admin issue about it: https://github.com/getgrav/grav-plugin-admin/issues

11 years ago

I set "date: '2015.09.01 14:55'" in the yaml page.md file, but the site shows "02 Sep". Is it getting the date off of the file ctime?

11 years ago

An exception has been thrown during the rendering of a template ("DateTime::__construct(): Failed to parse time string (2015.09.01 14:55) at position 5 (0): Double time specification") in "forms/fields/datetime/datetime.html.twig" at line 4.

11 years ago

Hmm.. i'll have to test this.. to be honest i've only ever used US or Euro style, never this ISO Y.M.D style date.

11 years ago

Can you create an issue for me so i don't lose track of this one? I'm in the middle of a few other issues at the moment. cheers!

10 years ago

Hm, I have tried to set the “Published date” of blog posts in the admin area. Regardless of whether I use US or Euro style, the system always throws the same error as soon as I try to save the settings. It reads, “0 - An exception has been thrown during the rendering of a template ("DateTime::__construct(): Failed to parse time string (16, 2016) at position 0 (1): Unexpected character") in "forms/fields/datetime/datetime.html.twig" at line 7.”
But for the life of me, I cannot see which “unexpected character” the system might refer to. At any rate, the published time will always be set to the day one creates the page.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago