Bug #19056

eval "timesec" sets seconds to zero

Added by Jochen Rau about 11 years ago. Updated about 9 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


If a column in $TCA configured to 'eval' => 'timesec' the seconds are set to zero after leaving the BE-field.

This is caused by the following lines in "jsfunc.evalfield.js":

// Seconds since midnight:
function evalFunc_getTime(timeObj) {
return timeObj.getUTCHours()*60*60+timeObj.getUTCMinutes()*60+Math.round(timeObj.getUTCSeconds()/1000);

They should be:

// Seconds since midnight:
function evalFunc_getTime(timeObj) {
return timeObj.getUTCHours()*60*60+timeObj.getUTCMinutes()*60+timeObj.getUTCSeconds();

The bug occurs only if there is no checkbox.
(issue imported from #M8893)

8893_4.3_alpha1.patch View (562 Bytes) Administrator Admin, 2009-01-11 03:27

T3X_bug_8893-0_0_0-z-201006171118.t3x (4.69 KB) Administrator Admin, 2010-06-17 11:31

Related issues

Related to TYPO3 Core - Bug #15133: Date/time field changes its value Closed 2005-10-20


#1 Updated by Martin Kutschker about 11 years ago

Doesn't the change conflict with other time fields that require (?) the seconds to be cleared.

#2 Updated by Jochen Rau about 11 years ago

No, it doesn't. The function "evalFunc_getTime" is called only if "eval" is set to "time" or "timesec". If it is set to "time" the seconds in the output string are truncated. If it is set to "timesec" everything works fine after the patch was applied.

I think it was never intended to "clear" the seconds with "Math.round(timeObj.getUTCSeconds()/1000)".

I also suggest to rename the functions to clarify their behaviour
evalFunc_getTime -> evalFunc_getUTCTime
evalFunc_getTimeSecs -> evalFunc_getLocalTime
because they should always return seconds.

BTW the function "evalFunc_getSecs" is also wrong. But this isn't bad - it's never used anywhere ;-).

#3 Updated by Ralf Hettinger over 10 years ago

Confirming the bugy behaviur as well as the suggested fix itself by testing it.
Patch against 4.3_alpha1 is attached.

#4 Updated by koi over 10 years ago

see Ralf Hettinger 11.01.09 03:28 line no. 1
test on 4.2.5
patch applied
cleared all cash
nevertheless, have no chance to get in seconds on my my be/fe-editing forms.
as soon as leaving the field defined by 'eval timesec' its going to cut off seconds.
(integer value in db is rounded to plain minutes)
any suggestions?

#5 Updated by Peter Kuehn over 9 years ago

i can confirm the bug exists and is solved by the suggested change.
we┬┤ll address the issue during the next bugday to get the change into svn

#6 Updated by Andy Grunwald over 9 years ago


i can confirm this bug in revision 7947 of typo3 trunk, too.
I`ve created a dummy extension to reproduce this bug (see attachement).

How to reproduce this bug:
- Install the dummy extension
- Edit a page record
- Search the fields "bug_8893 without checkbox" and "bug_8893 with checkbox" (look at "Extended"-tab)
- Add the dummy value "10:56:15" to the field "bug_8893 without checkbox" and klick next to the field. The value "10:56:00" appears.
- Add the dummy value "10:56:15" to the field "bug_8893 with checkbox" and klick next to the field. The value "10:56:15" appears.
- Apply the patch and repeat the last two steps
- Now the value "10:56:15" in the field "bug_8893 without checkbox" appears

I`ve posted this bug to the core list.
If you have a few seconds, please add a +1 on the core list.

Thanks to Jochen and Ralf Hettinger for the solution and for the rest who confirmed this bug.

#7 Updated by Ernesto Baschny over 9 years ago

Fix commited to:

- trunk: rev. 8000 (!), will be in 4.4.0
- TYPO3_4-3: rev. 8001, will be in 4.3.4
- TYPO3_4-2: rev. 8002, will be in 4.2.13

Also available in: Atom PDF