Bug #73871

Problem with date Field

Added by Juraj Sulek over 3 years ago. Updated 12 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-03-02
Due date:
% Done:

100%

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

Description

We have discovered one bug with date field

sql:
birthday date DEFAULT '0000-00-00',

TCA:
'birthday' => array(
'exclude' => 1,
'label' => 'Birthday',
'config' => array(
'dbType' => 'date',
'type' => 'input',
'size' => 7,
'eval' => 'date',
'checkbox' => 0,
'default' => '0000-00-00'
),
),

if the date in the field is bigger then 1.1.1970 all works fine. But if the date ist lower for example 1.1.1969. This happens:
- FE shows 1.1.1969 - OK
- BE list-view shows 1.1.1969 - OK
but if the record is open for editing the field is filled with date -1 DAY - in this case the date 31.12.1968


Related issues

Related to TYPO3 Core - Bug #69290: Dates get reduced by a day if before 1970 Closed 2015-08-24
Related to TYPO3 Core - Bug #37244: TCA date evaluation for dates lower 01-01-1970 fails Accepted 2012-05-17

Associated revisions

Revision 41b350dc (diff)
Added by Daniel Maier over 3 years ago

[BUGFIX] Fix date conversion of neg timestamps

Date conversion of TCA fields with eval "date" or "datetime" is now also
handled correctly for dates before 1970, thus having a negative
timestamp. Timezone offset is now also applied for those negative
timestamps, in order to prevent erroneous data for dates before 1970.

Furthermore validation handling for dates with zero timestamp
(01.01.1970 midnight UTC) is fixed.

Resolves: #73871
Releases: master, 7.6
Change-Id: Iffa2f12c6941fe17b956202fe9c49f811b1b0539
Reviewed-on: https://review.typo3.org/47025
Reviewed-by: Andreas Wolf <>
Tested-by: Andreas Wolf <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 7090d9b6 (diff)
Added by Daniel Maier over 3 years ago

[BUGFIX] Fix date conversion of neg timestamps

Date conversion of TCA fields with eval "date" or "datetime" is now also
handled correctly for dates before 1970, thus having a negative
timestamp. Timezone offset is now also applied for those negative
timestamps, in order to prevent erroneous data for dates before 1970.

Resolves: #73871
Releases: master, 7.6
Change-Id: I4de9911dec3de720992da137fe8afcb3ecbfdad7
Reviewed-on: https://review.typo3.org/47115
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Andreas Wolf <>
Tested-by: Andreas Wolf <>

Revision a37f6161 (diff)
Added by Daniel Maier over 3 years ago

[BUGFIX] Fix date conversion of neg timestamps

Date conversion of TCA fields with eval "date" or "datetime" is now also
handled correctly for dates before 1970, thus having a negative
timestamp. Timezone offset is now also applied for those negative
timestamps, in order to prevent erroneous data for dates before 1970.

Resolves: #73871
Releases: master, 7.6
Change-Id: I4de9911dec3de720992da137fe8afcb3ecbfdad7
Reviewed-on: https://review.typo3.org/47115
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
(cherry picked from commit 7090d9b67735ba10ca3d2e024cb376b991e26366)
Reviewed-on: https://review.typo3.org/47117

History

#1 Updated by Daniel Maier over 3 years ago

  • Status changed from New to Accepted

Conversion from Date to Timestamp and back does not work correct in this case (first conversion (on php-side) is done with configured phpTimeZone, the second one (on js-side) with UTC).

Can be reproduced using input_36 of styleguide-extension. Select a date lower to 1970 here (e.g. 31-12-1969). Each time the form is saved, the date is reduced by one day (e.g. 30-12-1969, next 29-12-1969, next 28-12-1969, and so on).

If date is set to 01-01-1970, no value is shown in the FormEngine.

#2 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47025

#3 Updated by Christian Kuhn over 3 years ago

input_36 and input_37 were added to tx_styleguide_elements of ext:styleguide to better test this.

#4 Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47025

#5 Updated by Gerrit Code Review over 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47025

#6 Updated by Gerrit Code Review over 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47025

#7 Updated by Gerrit Code Review over 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47025

#8 Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47099

#9 Updated by Daniel Maier over 3 years ago

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

#10 Updated by Christian Kuhn over 3 years ago

  • Status changed from Resolved to New

patch was reverted - still working on it.

#11 Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47115

#12 Updated by Daniel Maier over 3 years ago

  • Status changed from Under Review to Resolved

#13 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47117

#14 Updated by Daniel Maier over 3 years ago

  • Status changed from Under Review to Resolved

#15 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF