filament icon indicating copy to clipboard operation
filament copied to clipboard

DatePicker BST/Europe/London Timezone Issue with Daylight Savings Time

Open SOD96 opened this issue 8 months ago • 1 comments

Package

filament/filament

Package Version

v3.3.4

Laravel Version

v11.44.2

Livewire Version

v3.0.0

PHP Version

PHP 8.4.6

Problem description

When using the timezone option for the date time picker, it doesn't seem to take into account when a country has DST Enabled. When I've been saving dates which have Europe/London as the timezone, it always saves one hour into the future.

I don't recall this being a problem before the UK went into DST, so it makes sense it's came up now.

Also, I'm aware how headache inducing timezones can be, apologies. To be clear, +1 timezones do work correctly, if you do Africa/Tunis then it'll save in the DB as 1 hour behind whatever you set. It's only Daylight Savings Time that seems to not be taken into account.

Expected behavior

When I set the timezone on the DateTimePicker I expect it to convert the dates back into UTC as that's what the server is set to. The documentation states this should happen: https://filamentphp.com/docs/3.x/forms/fields/date-time-picker#timezones

While dates will still be stored using the app’s configured timezone, the date will now load in the new timezone, and it will be converted back when the form is saved.

Steps to reproduce

  1. Add a DateTimePicker component to any form
  2. Set the timezone method to Europe/London which is currently observing BST (+1)
  3. It's currently 2:40PM in the UK so set the date to 08/05/2025 14:40
  4. Save the resource

If you check the DB, the saved field will be still 14:40, when due to BST being in place, it should be 13:40 as that is what the UTC time is

If I set my timezone to an actual +1 timezone say Africa/Tunis then it works as expected

Reproduction repository (issue will be closed if this is not valid)

https://github.com/SOD96/filament-timezone-repo

Relevant log output


SOD96 avatar May 08 '25 13:05 SOD96

maybe this will fix your issue?

https://github.com/filamentphp/filament/issues/15571#issuecomment-2887949749

anditsung avatar May 17 '25 02:05 anditsung

Hey! I just downloaded the repo, created a new post, set the date/time to be 12:45pm (I am also in the UK and it is currently BST), and it saved correctly in the database as 11:45am. I also updated it to be two hours later, and it correctly saved.

The only thing I can think of that may have happened, is you selected a date/time after BST ends? Otherwise, I am going to need more info to help me reproduce this, sorry.

danharrin avatar Jul 11 '25 11:07 danharrin