mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 22:14:58 +08:00
FormattingUtils: Add a formatCountLong method.
This commit is contained in:
parent
47999c2e46
commit
2d8477aaa6
@ -30,6 +30,15 @@ export function formatCount(count) {
|
|||||||
return (count / 1000000000).toFixed(1) + "B"; // 10B is enough for anyone, right? :S
|
return (count / 1000000000).toFixed(1) + "B"; // 10B is enough for anyone, right? :S
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a count showing the whole number but making it a bit more readable.
|
||||||
|
* e.g: 1000 => 1,000
|
||||||
|
*/
|
||||||
|
export function formatCountLong(count) {
|
||||||
|
const formatter = new Intl.NumberFormat();
|
||||||
|
return formatter.format(count)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format a size in bytes into a human readable form
|
* format a size in bytes into a human readable form
|
||||||
* e.g: 1024 -> 1.00 KB
|
* e.g: 1024 -> 1.00 KB
|
||||||
|
Loading…
Reference in New Issue
Block a user