diff --git a/lib/joolaio.string.js b/lib/joolaio.string.js index c812190..deb5706 100644 --- a/lib/joolaio.string.js +++ b/lib/joolaio.string.js @@ -128,11 +128,14 @@ joolaio.string.shortenNumber = function (n) { } joolaio.string.intToTime = function (TimeInSeconds) { - + var negative = false; + if (TimeInSeconds < 0) { + negative = true; + TimeInSeconds = Math.abs(TimeInSeconds); + } var sHours = (Math.round(((TimeInSeconds / 60.0) / 60) - 0.5, 0)).toString(); var sMinutes = (Math.round((TimeInSeconds / 60.0) - 0.5, 0) % 60).toString(); var sSeconds = parseInt((TimeInSeconds % 60)).toString(); - if (sHours.length == 1) sHours = '0' + sHours; if (sMinutes.length == 1) @@ -140,6 +143,9 @@ joolaio.string.intToTime = function (TimeInSeconds) { if (sSeconds.length == 1) sSeconds = '0' + sSeconds; - return sHours + ':' + sMinutes + ':' + sSeconds; + if (!negative) + return sHours + ':' + sMinutes + ':' + sSeconds; + else + return '-' + sHours + ':' + sMinutes + ':' + sSeconds; } \ No newline at end of file