Bug #81719
closed
Epic #77562: Misbehaviors with datetime values and timezones
DateTime comparisons not possible in 8.7
Added by Uwe Michelfelder over 7 years ago.
Updated over 1 year ago.
Description
Comparison based custom queries on DateTime values do not work anymore, because they do not get converted correctly in the Typo3DbQueryParser-> createTypedNamedParameter function.
There in line 501
$plainValue = $this->dataMapper->getPlainValue($value);
The value gets always converted to a Unix Timestamp, although in our case DateTime is used in the database and TCA.
The reason for this is, that in the getPlainValue method of the DataMapper, the second parameter "columnMap" is needed to convert the DateTime values to a string correctly.
Is related to #79473
Related issues
1 (1 open — 0 closed)
- Related to Bug #79473: Typo3DbQueryParser fails since Doctrine by comparing date fields added
closed as duplicate. already solved.
- Status changed from New to Closed
Georg Ringer wrote:
closed as duplicate. already solved.
Hi Georg,
I don't see, that the actual type ot the date is taken in account in the latest version.
https://github.com/TYPO3/TYPO3.CMS/blob/0bd1746384980d9f6f7387d8638d280443ee843b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php
In line 414 and following there is still no "columnMap" as second parameter provided to the createTypedNamedParameter method:
case QueryInterface::OPERATOR_EQUAL_TO:
if ($value === null) {
$expr = $fieldName . ' IS NULL';
} else {
$placeHolder = $this->createTypedNamedParameter($value);
$expr = $exprBuilder->comparison($fieldName, $exprBuilder::EQ, $placeHolder);
}
break;
If the value is of type DateTime it still gets converted to a unixttimestamp (as a fallback) by createTypedNamedParameter method.
So in my eyes, this bug is not resolved an due to this, DateTime Values cannot be used straigt forward in the database and the extbase repositories methods.
All best,
Uwe
- Status changed from Closed to Accepted
- Parent task set to #77562
- Status changed from Accepted to Under Review
- Status changed from Under Review to New
- Related to deleted (Bug #79473: Typo3DbQueryParser fails since Doctrine by comparing date fields)
- Is duplicate of Bug #79473: Typo3DbQueryParser fails since Doctrine by comparing date fields added
- Status changed from New to Closed
Also available in: Atom
PDF