Refactor storage stats calculation to use powers of 2 for more accurate values (#6765)

* "Refactor storage stats calculation to use powers of 2 for more accurate values"

* replace 1000000 to 2^20

* Refactor storage unit size display to use binary prefixes

This commit updates the display of storage unit sizes in both the camera storage stats and the Storage component in the web UI to use binary prefixes (MiB and GiB) instead of decimal prefixes (MB and GB). This provides more accurate and consistent representation of storage sizes
This commit is contained in:
Sergey Krashevich
2023-06-11 22:49:13 +03:00
committed by GitHub
parent b359ff1b8e
commit dfd574beeb
5 changed files with 9 additions and 9 deletions

View File

@@ -26,9 +26,9 @@ export default function Storage() {
const getUnitSize = (MB) => {
if (isNaN(MB) || MB < 0) return 'Invalid number';
if (MB < 1024) return `${MB} MB`;
if (MB < 1024) return `${MB} MiB`;
return `${(MB / 1024).toFixed(2)} GB`;
return `${(MB / 1024).toFixed(2)} GiB`;
};
let storage_usage;