Skip to content

Commit

Permalink
fix(form): #2838
Browse files Browse the repository at this point in the history
Give.fn.unFormatCurrency will not able for unformat number if currency symbol contains decimal separator for example kr. 54,000 will be converted to 0.54 instead of 54000.

To fix this issue we are removing currency symbol from currency before passing to accounting unformat function.
  • Loading branch information
ravinderk committed Feb 23, 2018
1 parent 5cd40d1 commit bc15b12
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/js/frontend/give-donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ Give = {
* @returns {number}
*/
unFormatCurrency: function (price, decimal_separator) {
var index = 0;

// Remove currency symbol from price.
for( index; index <= price.length; index++ ){
if( parseInt( price[index] ) ) {
price = price.substr(index);
break;
}
}

return Math.abs(parseFloat(accounting.unformat(price, decimal_separator)));
},

Expand Down

0 comments on commit bc15b12

Please sign in to comment.