Fix friendlyDuration function

This commit is contained in:
buinsky 2015-01-29 17:13:48 +03:00
parent ba86d16e78
commit 1d5e52fc55

View file

@ -38,11 +38,11 @@ function friendlyDuration(seconds) {
if (minutes < 60)
return "QBT_TR(%1m)QBT_TR".replace("%1", parseInt(minutes));
var hours = minutes / 60;
minutes = minutes - hours * 60;
minutes = minutes % 60;
if (hours < 24)
return "QBT_TR(%1h %2m)QBT_TR".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes))
var days = hours / 24;
hours = hours - days * 24;
hours = hours % 24;
if (days < 100)
return "QBT_TR(%1d %2h)QBT_TR".replace("%1", parseInt(days)).replace("%2", parseInt(hours))
return "∞";