Bug #75260
closedTCA date/datetime labels for IRRE records displayed wrong
0%
Description
This bug report relates to bug report #64238 (https://forge.typo3.org/issues/64238)
The date/datetime labels displayed are timestamps and for some entries even wrong dates like e.g. '24-03-2000 (-416 Jahre)'.
Files
Updated by Wouter Wolters over 8 years ago
- Status changed from New to Needs Feedback
Do you have a screenshot of the situation you describe?
Updated by Ivan Ruiz Gallego over 8 years ago
- File Bildschirmfoto 2016-04-18 um 18.12.59.png Bildschirmfoto 2016-04-18 um 18.12.59.png added
- File Bildschirmfoto 2016-04-18 um 18.14.42.png Bildschirmfoto 2016-04-18 um 18.14.42.png added
The attached screenshots illustrate how the "inline" property "termine" is displayed in the backend. In one of them you see all "termine" collapsed. In the other one I have expanded one so that you can see the date set in it.
Updated by Wouter Wolters over 8 years ago
Thanks, do you also have the according TCA for us?
Updated by Ivan Ruiz Gallego over 8 years ago
Here you have the configuration for the property "further_dates" of the model "event"
'further_dates' => array( 'exclude' => 1, 'label' => 'LLL:EXT:bepagenda/Resources/Private/Language/locallang_db.xlf:tx_bepagenda_domain_model_event.further_dates', 'config' => array( 'type' => 'inline', 'foreign_table' => 'tx_bepagenda_domain_model_date', 'foreign_field' => 'event', 'maxitems' => 9999, 'appearance' => array( 'collapseAll' => 0, 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 1, 'showPossibleLocalizationRecords' => 1, 'showAllLocalizationLink' => 1 ), ), ),
Updated by Ivan Ruiz Gallego over 8 years ago
And here the relevant part TCA of the model "date":
'date' => array( 'exclude' => 1, 'label' => 'LLL:EXT:bepagenda/Resources/Private/Language/locallang_db.xlf:tx_bepagenda_domain_model_date.date', 'config' => array( 'dbType' => 'date', 'type' => 'input', 'size' => 7, 'eval' => 'date,required', 'checkbox' => 0, 'default' => '0000-00-00' ), ), 'starting_time' => array( 'exclude' => 1, 'label' => 'LLL:EXT:bepagenda/Resources/Private/Language/locallang_db.xlf:tx_bepagenda_domain_model_date.starting_time', 'config' => array( 'type' => 'input', 'size' => 4, 'eval' => 'time', 'checkbox' => 1, 'default' => time() ) ), 'ending_time' => array( 'exclude' => 1, 'label' => 'LLL:EXT:bepagenda/Resources/Private/Language/locallang_db.xlf:tx_bepagenda_domain_model_date.ending_time', 'config' => array( 'type' => 'input', 'size' => 4, 'eval' => 'time', 'checkbox' => 1, 'default' => time() ) ),
Updated by Ivan Ruiz Gallego over 8 years ago
Interestingly, the date is displayed correctly for the "date" table in the backend (see screenshot). That's why I thought that the cause of the problem is related to IRRE.
Updated by Wouter Wolters over 8 years ago
Thanks, will try to investigate this setup.
Updated by Oliver Pfaff over 8 years ago
Here my 2 cents. If i use a Date field like this:
'date' => array( 'exclude' => 1, 'label' => 'LLL:EXT:cashbook/Resources/Private/Language/locallang_db.xlf:tx_cashbook_domain_model_booking.date', 'config' => array( 'dbType' => 'date', 'type' => 'input', 'size' => 7, 'eval' => 'date', 'checkbox' => 0, 'default' => '0000-00-00' ), ),
i got the date well formated as title when the record is listed as standalone. Inside the parent record(listed as inline) i got the date as timestamp. i fix this in my extension with a label_userFunc in the TCA from the irre.
public function renderDateIrre(&$PA, $fObj) { if(is_int($PA['row']['date'])){ $PA['title'] = date('d-m-Y',$PA['row']['date']).', '.$PA['row']['text']; }else{ //$record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($PA['table'], $PA['row']['uid']); $PA['title'] = date('d-m-Y',strtotime($PA['row']['date'])); } }
If you debug $PA you will se that inside date you have one time a formatted date string, when the record is listet in the list module as standalone record. When you open the parent Record you will have a int timestamp in the date field. So i suppose there is somthing wrong with the mapping. I know TYPO3 make a lot of stuff with the fields marked as dateDB fields(i think it was in the datahandler.php) so it seems that system get the field date, transform this in timestamp and in the first case it will be formatted and in the irre call not.
Updated by Ivan Ruiz Gallego over 8 years ago
Dear Oliver
Thank you very much for your input! That worked for me: I could get the dates properly formated using "label_userFunc" in the TCA.
Updated by Georg Ringer about 8 years ago
- Status changed from Needs Feedback to Resolved
I am setting it to resolved as it works for you!
Updated by Jan Rödig over 7 years ago
Georg Ringer wrote:
I am setting it to resolved as it works for you!
I also came across this bug today and managed to make a workaround with a label_userFunc, but imho workarounds don't really solve this issue. BE rendering of date/datetime labels should be consistent - no matter if viewed in IRRE or in list view. If I'm wrong (as I'm a newbie) it would be nice if someone could give a short explanation why this behaviour should be considered normal. Thank you!