Kirby 3.4.0 Panel date field bug

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.

my index.php currently looks like this:

require __DIR__ . '/kirby/bootstrap.php';
echo (new Kirby)->render();

if i add your suggestion:

require __DIR__ . '/kirby/bootstrap.php';
echo (new Kirby)->render();

i get an error for this new line. So i don’t know how to really add this…


You need to pass the timezone as argument:

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