Hello there,
i am working on a website that has a couple of date fields in the Panel and i ran into this issue of wrongly stored dates.
My kirby version is 3.4.0 and i have tested this on a server and on my local machine, so i can say that a timezone difference of server / user can’t be the issue.
Then i changed my kirby version on my local machine to Kirby 3.3.3 and lo and behold, it worked.
So, without any deeper technical knowledge, i think something changed between 3.3.3 and 3.4.0 that causes the date to be saved one day earlier than picked.
I really hope this can be fixed in the future, but since i couldn’t find anyone else with that problem, it might be also something only i experienced?
You can use date_default_timezone_set() as workaround.
thanks. can you elaborate? where would i use this?
You can add date_default_timezone_set()
method to root index.php
.
Hey,
my index.php currently looks like this:
<?php
require __DIR__ . '/kirby/bootstrap.php';
echo (new Kirby)->render();
if i add your suggestion:
<?php
require __DIR__ . '/kirby/bootstrap.php';
date_default_timezone_set();
echo (new Kirby)->render();
i get an error for this new line. So i don’t know how to really add this…
Sorry
You need to pass the timezone as argument: https://www.php.net/manual/de/function.date-default-timezone-set.php
I’d put this on the first line after the opening php tag.
Ok, i managed to add the line and it works. Thanks a lot!!
Is this going to be fixed in future versions?
1 Like