Project

General

Profile

Actions

Bug #75260

closed

TCA date/datetime labels for IRRE records displayed wrong

Added by Ivan Ruiz Gallego about 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2015-01-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

Actions #1

Updated by Wouter Wolters about 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 about 8 years ago

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.

Actions #3

Updated by Wouter Wolters about 8 years ago

Thanks, do you also have the according TCA for us?

Actions #4

Updated by Ivan Ruiz Gallego about 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
                ),
            ),

        ),
Actions #5

Updated by Ivan Ruiz Gallego about 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()
            )
        ),
Actions #6

Updated by Ivan Ruiz Gallego about 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.

Actions #7

Updated by Wouter Wolters about 8 years ago

Thanks, will try to investigate this setup.

Actions #8

Updated by Oliver Pfaff almost 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.

Actions #9

Updated by Ivan Ruiz Gallego over 7 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.

Actions #10

Updated by Georg Ringer over 7 years ago

  • Status changed from Needs Feedback to Resolved

I am setting it to resolved as it works for you!

Actions #11

Updated by Jan Rödig almost 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!

Actions #12

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF