Browse Source

[IMP] currency formating

Gogs 7 years ago
parent
commit
263a722869
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/components/filters/currency.js

+ 4 - 0
src/components/filters/currency.js

@@ -8,6 +8,10 @@ const currency = (value = 0, symbol = '$', symbolPosition = 'before', thousandsS
         decimalPlaces = 2
     }
 
+    if (!!(`${thousandsSeparator}${decimalSeparator}`).replace(/\.,|,\./g, '')) {
+        throw new Error('Same thousands and decimal separator is not allowed')
+    }
+
     value = value.split('.')
 
     value[0] = value[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandsSeparator}`)