Project

General

Profile

Actions

Bug #21838

closed

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

Added by Équipe Tactic over 14 years ago. Updated over 9 years ago.

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

0%

Estimated time:
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 4 (1 open3 closed)

Related to TYPO3 Core - Bug #21602: Value Preview of empty timestamp shows "01-01-70 (-40 yrs) "Closed2009-11-18

Actions
Related to TYPO3 Core - Feature #61110: Support for timezones in all date fields in TYPO3 BENew2014-08-21

Actions
Related to TYPO3 Core - Bug #53640: js validation for datetime + required doesn't work for below 1970ClosedGeorg Ringer2013-11-14

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

Actions
Actions

Also available in: Atom PDF