diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 2df5daeb..c04ce6ef 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -360,7 +360,8 @@ function humanDuration(ms, sig='dhm', units='ms', return_seconds=300000) { sig = 'dhms' } - ms = ms * factors[units]; + r = factors[sig.slice(-1)]; + ms = Math.round(ms * factors[units] / r) * r; h = ms % factors['d']; d = Math.trunc(ms / factors['d']); diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 014f1359..dfc82d25 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -272,7 +272,8 @@ def human_duration(ms, sig='dhm', units='ms', return_seconds=300000): if return_seconds and ms < return_seconds: sig = 'dhms' - ms = ms * factors[units] + r = factors[sig[-1]] + ms = round(ms * factors[units] / r) * r d, h = divmod(ms, factors['d']) h, m = divmod(h, factors['h'])