Project

General

Profile

Actions

Bug #19056

closed

eval "timesec" sets seconds to zero

Added by Jochen Rau over 16 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2008-07-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

8893_4.3_alpha1.patch (562 Bytes) 8893_4.3_alpha1.patch Administrator Admin, 2009-01-11 03:27
T3X_bug_8893-0_0_0-z-201006171118.t3x (4.69 KB) T3X_bug_8893-0_0_0-z-201006171118.t3x Administrator Admin, 2010-06-17 11:31

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #15133: Date/time field changes its valueClosedErnesto Baschny2005-10-20

Actions
Actions #1

Updated by Martin Kutschker over 16 years ago

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

Actions #2

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 ;-).

Actions #3

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.

Actions #4

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?

Actions #5

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

Actions #6

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.

Actions #7

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

Actions

Also available in: Atom PDF