Project

General

Profile

Actions

Bug #62660

closed

Copying Date- and Datetime-Fields

Added by Christian Chabek over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
Start date:
2014-11-03
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Datetime
Complexity:
Is Regression:
No
Sprint Focus:

Description

A Field is defined as datetime in the TCA:

'start' => array(
  // ...
  'config' => array(
    'dbType' => 'datetime',
     // ...
  ),
),

The value gets correctly written to the database.
But when copying an entity in the backend and so copying the field, it shows something strange like "0:33 01-01-1970".

I've tracked this down to here:

// TYPO3\CMS\Core\DataHandling\DataHandler, Line 950
$incomingFieldArray[$column] = $incomingFieldArray[$column] ? gmdate($format, $incomingFieldArray[$column]) : $emptyValue;

Typo3 tries to format the already correctly formatted date-string.
The solution in my case was this check:

if (is_numeric($incomingFieldArray[$column])) {
  $incomingFieldArray[$column] = $incomingFieldArray[$column] ? gmdate($format, $incomingFieldArray[$column]) : $emptyValue;
}
Actions

Also available in: Atom PDF