fix #522: correctly pad days in Ox.formatDuration

This commit is contained in:
rolux 2012-06-11 13:40:28 +02:00
parent 7dd06c6d3e
commit 3c9c1cc4ed

View file

@ -502,8 +502,6 @@ Ox.formatDuration <f> Formats a duration as a string
'01:00:00.00'
> Ox.formatDuration(3599.999, 3)
'00:59:59.999'
> Ox.formatDuration(1640673)
'18:23:44:31'
> Ox.formatDuration(3599.999, 'short')
'1h'
> Ox.formatDuration(3599.999, 3, 'short')
@ -512,6 +510,8 @@ Ox.formatDuration <f> Formats a duration as a string
'1 hour'
> Ox.formatDuration(3599.999, 3, 'long')
'59 minutes 59.999 seconds'
> Ox.formatDuration(1640673)
'18:23:44:33'
> Ox.formatDuration(86520, 2)
'1:00:02:00.00'
> Ox.formatDuration(86520, 'long')
@ -542,7 +542,7 @@ Ox.formatDuration = function(seconds/*, decimals, format*/) {
: [],
pad = [
values[0].toString().length,
values[0] ? 3 : 1,
values[0] ? 3 : values[1].toString().length,
2,
2,
decimals ? decimals + 3 : 2