luci-base: cbi.js: use IEC 80000-13 units to format base 2 byte values

Fixes: #5354
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0a31efc858)
This commit is contained in:
Jo-Philipp Wich 2021-10-08 20:52:52 +02:00
parent 850fcaf0b9
commit 32fc8941b8

View file

@ -646,7 +646,11 @@ String.prototype.format = function()
for (i = 0; (i < units.length) && (val > mf); i++)
val /= mf;
subst = (i ? val.toFixed(pr) : val) + units[i];
if (i)
subst = val.toFixed(pr) + units[i] + (mf == 1024 ? 'i' : '');
else
subst = val + ' ';
pMinLength = null;
break;
}