Bug #21838

Date field on TCA can't accept 1-1-1970 as

Added by Équipe Tactic almost 10 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-12-10
Due date:
% Done:

0%

TYPO3 Version:
4.2
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

The problem arises when a backend field is setted as an input with an date evaluation ni the TCA (like this :
'dateacquisition' => array (
'exclude' => 0,
'label' => 'LLL:EXT:tactic_repoeuvres/locallang_db.xml:tx_tacticrepoeuvres_Oeuvres.dateacquisition',
'config' => array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0'
)
),
)
When you enter 1-1-1970 as a date, the javascript evaluation erases the field.

Tried on Firefox 3.5 and IE 8.

To fix the problem, I added the following line :
if (this.lastDate==0) {this.lastDate++;} // Adds one second if 1-1-1970 is entered, so the variable won't be evaluated as null
in the file :
t3lib\jsfunc.evalfield.js
after line 831

So that the zone becomes :
this.lastDate+=add*24*60*60;
if (this.lastDate==0) {this.lastDate++;} // Adds one second if 1-1-1970 is entered, so the variable won't be evaluated as null
return this.lastDate;

That makes sure a 1-1-1970 date would get a minimum of 1 second as a timestamp and won't be evaluated to null.

I am open to any other way to correct this bug.

(issue imported from #M13005)


Related issues

Related to TYPO3 Core - Bug #21602: Value Preview of empty timestamp shows "01-01-70 (-40 yrs) " Closed 2009-11-18
Related to TYPO3 Core - Feature #61110: Support for timezones in all date fields in TYPO3 BE New 2014-08-21
Related to TYPO3 Core - Bug #53640: js validation for datetime + required doesn't work for below 1970 Closed 2013-11-14
Related to TYPO3 Core - Bug #37244: TCA date evaluation for dates lower 01-01-1970 fails Accepted 2012-05-17

History

#1 Updated by Alexander Opitz over 6 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

#2 Updated by Équipe Tactic over 6 years ago

The issue still exists in 4.5. Can't use negative or null dates.

#3 Updated by Équipe Tactic over 6 years ago

Same thing with 6.1...

#4 Updated by Alexander Opitz over 6 years ago

  • Status changed from Needs Feedback to New

#5 Updated by Mathias Schreiber almost 5 years ago

  • Status changed from New to Closed
  • Is Regression set to No

Closing as dupe of #37244 which is WIP

Also available in: Atom PDF