[Owncloud] Bug in formatDate()

Christian Reiner foss at christian-reiner.info
Sat Jul 14 13:37:56 UTC 2012


Hello all, 
I was very surprised to find the reason for a strange formatted date in 
ownCloud. I'd say there is a small bug in function formatDate() implemented in 
file core/js/js.js, lines 516ff (bottom of the file). 

I made a test case where I copied that function and just removed the 
translation calls: 
http://jsfiddle.net/L7x2B/16/

You can see the problem in the minimalistic result table on the right side: 
the cells in the middle end with ":2" as minutes. That should be ":02" in my 
eyes. 

The reason obviously is in formatDate(), where adding leading zeros is only 
done for hours, not for minutes. The obvious correction:
>>> +':' +date.getMinutes();
<<< +((date.getMinutes()<10)?'0':'')+date.getMinutes()

Christian Reiner
-- 
arkascha
[ foss at christian-reiner.info ]



More information about the Owncloud mailing list