Closed Lownin closed 7 years ago
Hi @Lownin,
I presume you are using the demo content right? As you can see the date error is coming from the file blog_post.md file. I could recreate the error. At the time the demo content, Grav only supported a limited number of formats like m-d-Y
. Now it can use any formats.
You have two possibilities now. Either you change the date in the above file to, e.g., date: '2014-06-23'
or you can add the default format pages.dateformat.default: 'm-d-Y'
into your system.yaml
.
Sommerregen
For myself I add some code to recreate the problem in pure PHP.
// The "right" way defining default datetimes
$datetime = new DateTime('2014-06-23');
// A Hack using pages.dateformat.default: 'm-d-Y'`
$datetime = DateTime::createFromFormat('m-d-Y', '06-23-2014');
That worked. Thank you.
FYI: I just updated the theme and corrected the demo content. Thanks 👍
yetiforce Error!!! DateTime::__construct(): Failed to parse time string (04-2018-10 08:00:00) at position 0 (0): Unexpected character
Getting this error when attempting to use grav-theme-machine on fresh grav install.
"DateTime::__construct(): Failed to parse time string (06-23-2014) at position 0 (0): Unexpected character"
Highlights line 581 of system/src/Grav/Common/Utils.php
I'm running under MAMP on macOS.