mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
Cleanup Date.fromNow() and friendlySize()
This commit is contained in:
parent
2bd9528098
commit
a0f8ac0dad
7 changed files with 28 additions and 50 deletions
|
|
@ -99,16 +99,6 @@ export function inFocus() {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(number|string)} sizeInBytes
|
||||
* @returns {string}
|
||||
*/
|
||||
export function friendlySize(sizeInBytes) {
|
||||
sizeInBytes = pInt(sizeInBytes);
|
||||
const sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB'], i = pInt(Math.floor(Math.log(sizeInBytes) / Math.log(1024)));
|
||||
return (sizeInBytes / Math.pow(1024, i)).toFixed(2>i ? 0 : 1) + sizes[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} theme
|
||||
* @returns {string}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue