filament icon indicating copy to clipboard operation
filament copied to clipboard

DatePicker timezone issue

Open invaders-xx opened this issue 3 years ago • 3 comments

Package

filament/filament

Package Version

v2.13.12

Laravel Version

v9.19.0

Livewire Version

v2.10.5

PHP Version

PHP 8

Bug description

my app uses UTC as timezone

When I create a DatePicker, the date value returned is the day before the date selected when the field's attribute timezone is set to user's timezone ('Europe/Zurich') in my case or not set. It works when this attribute is set to 'UTC'. Below the form: image Below the data : image

Steps to reproduce

No response

Relevant log output

No response

invaders-xx avatar Jun 29 '22 10:06 invaders-xx

maybe this helps ? https://filamentphp.com/tricks/multiple-user-timezones

Saifallak avatar Jul 26 '22 12:07 Saifallak

Can you provide us a reproduction repository URL and then we'll look at your issue?

That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to give us some instructions on where to find the bug, and include a database seeder with everything we need to set it up quickly.

zepfietje avatar Jul 29 '22 10:07 zepfietje

The timezone must be ignored by the picker if there is no time to select. Or just don't add the timezone attribute when it's a date only field.

sweebee avatar Aug 07 '22 06:08 sweebee

@sweebee is right, the timezone() method is not appropriate for use on a date-only input - only time.

What you experienced is the desired behaviour of the date picker in this case - converting midnight Zurich time to UTC, which is a day before.

danharrin avatar Sep 25 '22 19:09 danharrin