Feature #38965

Add support for native date/time fields

Added by Xavier Perseguers over 7 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2012-07-15
Due date:
% Done:

100%

PHP Version:
5.3
Tags:
Complexity:
medium
Sprint Focus:

Description

TYPO3 stores date and date/time values as a Unix timestamp. This feature allows native database types to be used instead.

Native fields must be marked as such in the TCA using the "xtype" key:

'native_date' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:test_nativedate/locallang_db.xml:tx_testnativedate_example.native_date',
    'config' => array(
        'xtype'    => 'date',
        'type'     => 'input',
        'size'     => '8',
        'max'      => '20',
        'eval'     => 'date',
        'checkbox' => '0',
        'default'  => '0'
    )
),

"xtype" can be one of following value:

  • date
  • datetime

and works for any "type" of field.

T3X_test_nativedate.t3x (2.52 KB) Xavier Perseguers, 2012-07-15 16:43

T3X_test_nativedate-0_2_0.t3x (2.52 KB) Xavier Perseguers, 2012-07-15 21:43

convert-columns.php View (2.26 KB) Xavier Perseguers, 2012-07-16 10:43


Related issues

Related to TYPO3 Core - Bug #51918: Native date and datetime values do not consider timezone Closed 2013-09-11
Precedes TYPO3 Core - Feature #38974: Add support for native date/time fields Closed 2012-07-16

Associated revisions

Revision ccd6b9d9 (diff)
Added by Xavier Perseguers over 7 years ago

[FEATURE] Add support for native date/time fields

TYPO3 stores date and date/time values as a Unix timestamp.
This feature allows native database types to be used instead.

Native fields must be marked in the TCA using the key "dbType":

'my_native_date' => array(
'exclude' => 0,
'label' => 'My native date',
'config' => array(
'dbType' => 'date',
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0'
)
),

Supported types for "dbType" are: date, datetime

Change-Id: I078047abd7a93e16cfca7f1fec3fe52109c6d347
Resolves: #38965
Releases: 6.0
Reviewed-on: http://review.typo3.org/12808
Reviewed-by: Marcus Schwemer
Tested-by: Marcus Schwemer
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog

History

#1 Updated by Xavier Perseguers over 7 years ago

This test extension can be used to test that native and timestamp-based date and date/time fields can be properly handled by TYPO3.

#2 Updated by Xavier Perseguers over 7 years ago

DBAL handling (and enhancement of SQL parser) will be added once this approach has been accepted.

#3 Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12808

#4 Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/12808

#5 Updated by Xavier Perseguers over 7 years ago

This new version of the test extension supports the key "dbType" instead of "xtype" because reviewers ask for a better naming.

#6 Updated by Xavier Perseguers over 7 years ago

Small script to convert existing data.

#7 Updated by Xavier Perseguers over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#8 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF