Browse Source

Fungsi format jutaan, miliaran, dan triliunan

pull/2/head
Wahyu Ramadhan 2 years ago
parent
commit
0ae99d417a
  1. 12
      src/const/CustomFunc.js

12
src/const/CustomFunc.js

@ -285,7 +285,17 @@ export const formatThousand = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
export const formatLargeNumber = (num) => {
const formattedNum = formatThousand(num);
if (num >= 1000000000000) {
return `${(num / 1000000000000).toFixed(1)}T`;
} else if (num >= 1000000000) {
return `${(num / 1000000000).toFixed(1)}M`;
} else if (num >= 1000000) {
return `${(num / 1000000).toFixed(1)}Jt`;
}
return formattedNum;
};
/*
Using it:
sortBy(data, {

Loading…
Cancel
Save