Bug #91508
openEpic #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
0%
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
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.
Updated by Daniel Siepmann over 3 years ago
- Related to Bug #79448: Handling dates in the very past inside T3-Backend added
Updated by Quadronet no-lastname-given over 2 years ago
is there any solution for TYPO3 10?
It will be use in timeline extensions.
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.
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,
],
],
Updated by Daniel Siepmann about 2 months ago
- Related to Bug #37244: TCA date evaluation for dates lower 01-01-1970 fails added