#63482Query constraint on a DateTime field with a DateTime argument should trigger date format
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.
Reviews 3
Related issues 2
History 1225
-
Georg Ringer changed tracker
FeatureBug TYPO3 Version 6.2 Is Regression 0 <span data-processor="relativetime" data-value="2014-12-16T10:30:11+00:00" > 12/16/14, 10:30 </span> -
Sebastian Mazza commented <span data-processor="relativetime" data-value="2015-08-12T17:24:09+00:00" > 08/12/15, 17:24 </span>
I can also confirm the issue.
-
Felix Nagel commented <span data-processor="relativetime" data-value="2016-02-09T17:33:06+00:00" > 02/09/16, 17:33 </span>
Same issue when using dbType => date in TYPO3 7.6.2
-
Stefan Froemken commented and changed TYPO3 Version
6.27 Complexity medium <span data-processor="relativetime" data-value="2016-11-16T12:35:01+00:00" > 11/16/16, 12:35 </span>I currently have the same problem, but I don’t see any chance to solve that with 2 or 3 lines of code.
I slightly see a possibility to change preparseComparison(). We can add $query or $source as third parameter, but IMO changing DateTime objects at that point is the wrong way.
A better place would be resolveParameterPlaceholders(), but at that point we don’t have any information about colnames and classnames anymore. We need them to build a columnMap, which is currently not possible. To solve that we have to change many methodcalls and it seems more breaking than solving that problem.
I can confirm this problem for TYPO3 7.6, too.
-
Mona Muzaffar changed Related to #80852 <span data-processor="relativetime" data-value="2017-04-15T01:13:12+00:00" > 04/15/17, 01:13 </span>
-
Riccardo De Contardi changed parent task #77562 <span data-processor="relativetime" data-value="2017-06-07T13:06:54+00:00" > 06/07/17, 13:06 </span>
-
Riccardo De Contardi changed
Related to #80852<span data-processor="relativetime" data-value="2017-06-07T13:06:59+00:00" > 06/07/17, 13:06 </span> -
Georg Ringer changed Related to #79473 <span data-processor="relativetime" data-value="2018-01-03T14:19:32+00:00" > 01/03/18, 14:19 </span>
-
Felix Nagel commented <span data-processor="relativetime" data-value="2022-09-27T11:00:44+00:00" > 09/27/22, 11:00 </span>
Still an issue in TYPO3 11.5.16 when using dbType => date.
-
Gerrit Code Review pushed patch set 1 for main to change 88836 status
NewUnder Review <span data-processor="relativetime" data-value="2025-03-29T16:47:18+00:00" > 03/29/25, 16:47 </span> -
Gerrit Code Review pushed patch set 2 for main to change 88836 <span data-processor="relativetime" data-value="2025-03-30T05:13:10+00:00" > 03/30/25, 05:13 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 88840 <span data-processor="relativetime" data-value="2025-03-30T16:53:47+00:00" > 03/30/25, 16:53 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 88840 <span data-processor="relativetime" data-value="2025-03-30T17:08:06+00:00" > 03/30/25, 17:08 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 88840 <span data-processor="relativetime" data-value="2025-03-30T17:11:20+00:00" > 03/30/25, 17:11 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 88840 <span data-processor="relativetime" data-value="2025-03-30T20:39:22+00:00" > 03/30/25, 20:39 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88951 <span data-processor="relativetime" data-value="2025-04-07T07:28:22+00:00" > 04/07/25, 07:28 </span>
-
Gerrit Code Review pushed patch set 2 for 13.4 to change 88951 <span data-processor="relativetime" data-value="2025-04-07T17:36:29+00:00" > 04/07/25, 17:36 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 88840 <span data-processor="relativetime" data-value="2025-04-07T17:37:24+00:00" > 04/07/25, 17:37 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 88840 <span data-processor="relativetime" data-value="2025-04-10T08:09:36+00:00" > 04/10/25, 08:09 </span>
-
Gerrit Code Review pushed patch set 3 for 13.4 to change 88951 <span data-processor="relativetime" data-value="2025-04-10T08:10:40+00:00" > 04/10/25, 08:10 </span>
-
Gerrit Code Review pushed patch set 4 for 13.4 to change 88951 <span data-processor="relativetime" data-value="2025-04-10T08:32:46+00:00" > 04/10/25, 08:32 </span>
-
Gerrit Code Review pushed patch set 7 for main to change 88840 <span data-processor="relativetime" data-value="2025-04-10T08:33:40+00:00" > 04/10/25, 08:33 </span>
-
Benjamin Franzke commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-04-11T08:15:12+00:00" > 04/11/25, 08:15 </span>Applied in changeset commit:8d2761ad5a2deaf2ff58e7a0e60ba0cfd8c1c49b.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:36:43+00:00" > 12/02/25, 14:36 </span>
I can confirm the issue! And the workaround would make it impossible to change the dbtype later without changing all constraints..