Bug #19056
closedeval "timesec" sets seconds to zero
0%
Description
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)
Files
Updated by Martin Kutschker over 16 years ago
Doesn't the change conflict with other time fields that require (?) the seconds to be cleared.
Updated by Jochen Rau over 16 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 ;-).
Updated by Ralf Hettinger almost 16 years ago
Confirming the bugy behaviur as well as the suggested fix itself by testing it.
Patch against 4.3_alpha1 is attached.
Updated by koi almost 16 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?
Updated by Peter Kuehn over 14 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
Updated by Andy Grunwald over 14 years ago
Hey,
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.
Updated by Ernesto Baschny over 14 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