Updated number formatter to use locale method

no refs

Updates number formatter to use native `toLocaleString` instead of custom regex
This commit is contained in:
Rish 2021-03-08 22:59:13 +05:30
parent 3067456a0e
commit 2e41b24240

View File

@ -192,7 +192,10 @@ export const getCurrencySymbol = (currency) => {
};
export const formatNumber = (amount) => {
return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
if (amount === undefined || amount === null) {
return '';
}
return amount.toLocaleString();
};
export const createPopupNotification = ({type, status, autoHide, duration, closeable, state, message, meta = {}}) => {