From 2d8477aaa69ac35c451c8a47691a0372cb635175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 24 Jan 2020 16:13:55 +0100 Subject: [PATCH] FormattingUtils: Add a formatCountLong method. --- src/utils/FormattingUtils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/FormattingUtils.js b/src/utils/FormattingUtils.js index 9016d62cfb..b932214530 100644 --- a/src/utils/FormattingUtils.js +++ b/src/utils/FormattingUtils.js @@ -30,6 +30,15 @@ export function formatCount(count) { 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 * e.g: 1024 -> 1.00 KB