summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/views/filters/bytes.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/app/common/views/filters/bytes.ts b/src/client/app/common/views/filters/bytes.ts
index 3afb11e9ae..f7a1b2690f 100644
--- a/src/client/app/common/views/filters/bytes.ts
+++ b/src/client/app/common/views/filters/bytes.ts
@@ -1,8 +1,10 @@
import Vue from 'vue';
Vue.filter('bytes', (v, digits = 0) => {
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
- if (v == 0) return '0Byte';
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+ if (v == 0) return '0';
+ const isMinus = v < 0;
+ if (isMinus) v = -v;
const i = Math.floor(Math.log(v) / Math.log(1024));
- return (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
+ return (isMinus ? '-' : '') + (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
});