Feature: #105549 - Support qualified and unqualified ISO8601 dates in DataHandler
See forge#105549
Description
The
Data
PHP API has been
extended to support qualified and unqualified ISO8601 date formats in order to
correctly process supplied timezone offsets, if supplied.
- Qualified ISO8601: Includes an explicit timezone offset (e.g., 1999-12-11T10:09:00+01:00 or 1999-12-11T10:09:00Z)
- Unqualified ISO8601: Omits timezone offsets, representing "LOCALTIME" (e.g., 1999-12-11T10:09:00)
TYPO3
Data
now accepts five
different formats:
Format | Examples | |
---|---|---|
Unqualified ISO8601 (LOCALTIME) |
'Y- | 1999- |
Qualified ISO8601 |
'Y- |
|
DateTime objects |
\Date |
|
SQL flavored dates (internal) |
'Y- | 1999- |
Unix timestamps (internal) |
'U' | 942315071 |
The ISO8601 variants and
\Date
objects are intended to be
used as API. The SQL flavored variant and unix timestamps are mainly targeted
for copy and import operations of native datetime and unix timestamp database
fields and are considered internal API.
$myDate = new \DateTime('yesterday');
$this->dataHandler->start([
'tx_myextension_mytable' => [
'NEW-1' => [
'pid' => 2,
// Format as LOCALTIME
'mydatefield_1' => $myDate->format('Y-m-dTH:i:s'),
// Format with timezone information
// (offsets will be normalized to persistence timezone format,
// UTC for integer fields, LOCALTIME for native DATETIME fields)
'mydatefield_2' => $myDate->format('c'),
// Pass \DateTimeInterface objects directly
'mydatefield_3' => $myDate,
],
],
]);
Impact
TYPO3 now provides accurate and consistent handling of ISO8601 dates, eliminating previous issues related to timezone interpretation and LOCALTIME representation.