Bug #63482
closedEpic #77562: Misbehaviors with datetime values and timezones
Query constraint on a DateTime field with a DateTime argument should trigger date format
100%
Description
Hi,
I have a DateTime declared like this in TCA :
'dbType' => 'datetime', 'type' => 'input', 'size' => 12, 'eval' => 'datetime,required', 'checkbox' => 0, 'default' => '0000-00-00 00:00:00'
The SQL field is a native DateTime field (created from extension_builder).
When I apply a constraint on a query with an argument, It is automatically converted to an unix timestamp. My query doesn't works because it's expecting a native SQL datetime value instead of a timestamp. The workaround is to apply a format ->format("Y-m-d G:i:s")
on the argument. This is ok but when you have to manipulate many datetime fields or have many queries, the human error factor is increasing.
I don't have digged enough inside the extbase query API to see if we have access to the field type at the moment when the query is build. But It could be great to see this API to take in charge the date formatting step.
I think that this change is a breaking change for all of those who already applied manually the format. It will require a setting to enable/disable this behaviour and by default , It will be disabled.