mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
use 1000 instead of 1024 to show correct fileSize
This commit is contained in:
@@ -12,9 +12,9 @@ class FileSize extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const units = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
const units = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
const i = Math.floor(Math.log(bytes) / Math.log(1000));
|
||||||
|
|
||||||
const size = i === 0 ? bytes : (bytes / 1024 ** i).toFixed(2);
|
const size = i === 0 ? bytes : (bytes / 1000 ** i).toFixed(2);
|
||||||
return `${size} ${units[i]}`;
|
return `${size} ${units[i]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user