parent
64f36098d9
commit
83f6400d4d
1 changed files with 4 additions and 0 deletions
|
|
@ -22,6 +22,10 @@ export const parseNumberFromString = (value, decimals = 2) => {
|
|||
const normalizedValue = value.replace(',', '.').replace(/[^0-9.]/g, '');
|
||||
const parsed = parseFloat(normalizedValue);
|
||||
|
||||
if(parsed > 10e10)
|
||||
return 0;
|
||||
|
||||
|
||||
if (isNaN(parsed)) return 0;
|
||||
return Math.round(parsed * Math.pow(10, decimals)) / Math.pow(10, decimals);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue