mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
Do not print bytes with decimal place
This commit is contained in:
@@ -14,7 +14,7 @@ class FileSize extends React.Component<Props> {
|
||||
const units = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
|
||||
const size = (bytes / 1024 ** i).toFixed(2);
|
||||
const size = i === 0 ? bytes : (bytes / 1024 ** i).toFixed(2);
|
||||
return `${size} ${units[i]}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user