diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-08-24 08:57:54 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-24 08:57:54 +0900 |
| commit | 91f8adc138b8d7bcba16ddb8df4d4b4270a442ba (patch) | |
| tree | 0f61feb5cd665f856f6314a67499a802e2b58856 /src/client/app/common | |
| parent | Merge pull request #2444 from syuilo/develop (diff) | |
| parent | 8.6.0 (diff) | |
| download | misskey-91f8adc138b8d7bcba16ddb8df4d4b4270a442ba.tar.gz misskey-91f8adc138b8d7bcba16ddb8df4d4b4270a442ba.tar.bz2 misskey-91f8adc138b8d7bcba16ddb8df4d4b4270a442ba.zip | |
Merge pull request #2445 from syuilo/develop
8.6.0
Diffstat (limited to 'src/client/app/common')
| -rw-r--r-- | src/client/app/common/views/filters/bytes.ts | 8 |
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]; }); |