Open kiler129 opened 1 year ago
I can confirm this behavior. Exactly like @kiler129 described. Is there any workaround? Times are displayed in the correct timezone, but the filter are not calculating with the timezone offset. That leads to wrong results after filtering.
I actually just got it to work.
public function configureFilters(Filters $filters): Filters
{
return parent::configureFilters($filters)
->add(
DateTimeFilter::new('createdAt')
->setFormTypeOptions([
'value_type_options' => [
'model_timezone' => 'UTC',
'view_timezone' => 'Europe/Berlin',
],
])
)
;
}
Describe the bug The
DateField
seems to completely ignore any timezone settings, which is a problem in some UTC offsets with dates being displayed one day earlier on lists than entered.To Reproduce Running EAB v4.5.0:
Additional context In my case Symfony, PHP, and PgSQL are all set to UTC. It seems like EAB correctly formats the date on lists, but doesn't set the correct parameters to Symfony form fields. Ostensibly the fix is simple:
However, this looks like it's triggering a Symfony bug as the form component forms data on display (model => form) but not on submission (form => model):
![image](https://user-images.githubusercontent.com/1227834/212820692-ace074df-502c-4277-9d5a-ee82377e2dd9.png)