This commit is contained in:
rakesh 2022-01-27 11:55:25 +05:30
parent ee1df7fee0
commit 31d3fe75d8
1 changed files with 6 additions and 1 deletions

View File

@ -707,8 +707,13 @@ export const priceFormatter = (price, pdp) => {
return Number(price).toFixed(2); return Number(price).toFixed(2);
if (decimals.length == 2 && pdp) //if 2 or 2.1 if (decimals.length == 2 && pdp) //if 2 or 2.1
return price; return price;
else if (decimals.length > 1) // if 2.34 or 2.56565 else if (decimals.length > 1) // if 2.34 or 2.56565
return Number(price.match(/^-?\d+(?:\.\d{0,4})?/)[0]); {
return price.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
}
// if 2.34 or 2.56565
// return Number(price.match(/^-?\d+(?:\.\d{0,4})?/)[0]);
} }
} }