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

Saving in site date format crashes site. #2394

Open
dcrobertson01 opened this issue Jan 28, 2024 · 2 comments
Open

Saving in site date format crashes site. #2394

dcrobertson01 opened this issue Jan 28, 2024 · 2 comments

Comments

@dcrobertson01
Copy link

Hi - whenever I save a file with a date greater than the 12 of the month, I get a 'Crickey there was an error', and the whole page is an error - with

An exception has been thrown during the rendering of a template ("Failed to parse time string (13/11/2024) at position 0 (1): Unexpected character").

When I open the page in a text editor, and change or remove the date, the page still fails.

No matter what I do, I still get this error. I've cleared the cache, deleted the cache, restarted the server and so on but it still errors on the date - even when it is no longer there. Caching is also disabled.

The only way to save the page is to delete it in the admin interface, add a new one and make sure the date is not greater than the 12th of the month.

Any solution to this?

@dcrobertson01
Copy link
Author

Downloading the latest Grav+admin bundle, removing the user directory, and copying my entire user directory into the folder to replace it seems to have fixed it.

@rhukster
Copy link
Member

rhukster commented Feb 3, 2024

Ok, so first off the default is US Dates with slashes (/) which works in m/d/Y format so that means 12/03/24 is acutally December 3rd, 2024. Alternative you can use dashes (-) for default Euro format: d-m-Y.

If you want to use Euro format even with slashes, you just set it in the configuration: system -> pages -> dateformat -> default. Set this to d/m/Y. Or you can use any custom PHP date compatible format: https://www.php.net/manual/en/datetime.formats.php

That all said, it shouldn't error out on a bad date, it should just fallback to the timestamp of the file if it can't parse the date correctly, so i've fixed that for the next release.

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