Project

General

Profile

Actions

Bug #91508

open

Epic #77562: Misbehaviors with datetime values and timezones

It is not possible to save "negative" dates, e.g. a year before jesus christus with date inputs

Added by Daniel Siepmann almost 4 years ago. Updated about 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2020-05-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Example setup to reproduce:

1. raise storage for field:

CREATE TABLE tt_content (
    starttime bigint,
);

2. Select an date before year 0.
3. Save
4. You'll see the same year but after 0, not before 0.

The same happens when changing the setup of the field:


$GLOBALS['TCA']['tt_content']['columns']['starttime'] = [
    'exclude' => 0,
    'label' => 'Some year',
    'config' => [
        'type' => 'input',
        'renderType' => 'inputDateTime',
        'eval' => 'date, int, required',
    ],
];


Files

Screenshot from 2020-05-27 16-26-19.png (9.15 KB) Screenshot from 2020-05-27 16-26-19.png After selecting date, before saving Daniel Siepmann, 2020-05-27 16:26
Screenshot from 2020-05-27 16-26-29.png (9.09 KB) Screenshot from 2020-05-27 16-26-29.png After saving Daniel Siepmann, 2020-05-27 16:26
Screenshot from 2020-06-03 08-51-38.png (10.7 KB) Screenshot from 2020-06-03 08-51-38.png JS Console formatting moment js Daniel Siepmann, 2020-06-03 08:51

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #79448: Handling dates in the very past inside T3-BackendClosed2017-01-24

Actions
Related to TYPO3 Core - Bug #37244: TCA date evaluation for dates lower 01-01-1970 failsClosed2012-05-17

Actions
Actions #1

Updated by Daniel Siepmann almost 4 years ago

Digging deeper, I found out that TYPO3/CMS/Backend/FormEngineValidation is converting the year into positive year already inside FormEngineValidation.updateInputField.

When faking and overwriting the values in this method, moment js will still format the year as positive year.

Actions #2

Updated by Riccardo De Contardi almost 4 years ago

  • Parent task set to #77562
Actions #3

Updated by Riccardo De Contardi almost 4 years ago

Maybe related? #79448

Actions #4

Updated by Daniel Siepmann over 3 years ago

  • Related to Bug #79448: Handling dates in the very past inside T3-Backend added
Actions #5

Updated by Quadronet no-lastname-given over 2 years ago

is there any solution for TYPO3 10?
It will be use in timeline extensions.

Actions #6

Updated by Benni Mack 9 months ago

  • Status changed from New to Closed

we've finally fixed this in TYPO3 v12. With type=datetime (and even better with dbType=date and format=date) this works just fine, tested this just now. https://docs.typo3.org/m/typo3/reference-tca/12.4/en-us/ColumnsConfig/Type/Datetime/Index.html

If you feel this is still an issue in TYPO3 v12, let me know, and I will-re-open the issue.

Actions #7

Updated by Daniel Siepmann about 2 months ago ยท Edited

  • Status changed from Closed to New

I currently can't make this work in v12.
MySQL already states it can't handle dates prior year 1000: https://dev.mysql.com/doc/refman/8.0/en/datetime.html

The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.

Also the JS doesn't allow me to select older dates. It works fine until 1970, but older dates behave strange. E.g. I could insert Year 100, but counting down ends up in 1999. Negative years are even ignored within the date picker.

Tested with v12.4.10.

I used the following TCA (with auto generated sql):

        'date' => [
            'exclude' => 0,
            'label' => $languageFile . '.date',
            'config' => [
                'type' => 'datetime',
                'format' => 'date',
                'dbType' => 'date',
                'required' => true,
            ],
        ],
Actions #8

Updated by Daniel Siepmann about 2 months ago

  • Related to Bug #37244: TCA date evaluation for dates lower 01-01-1970 fails added
Actions

Also available in: Atom PDF