Browse Source

REF

localNotifications
Overtorment 6 years ago
parent
commit
e0a469ad03
  1. 17
      currency.js
  2. 8
      loc/index.js

17
currency.js

@ -93,21 +93,10 @@ function satoshiToLocalCurrency(satoshi) {
}
function BTCToLocalCurrency(bitcoin) {
if (!lang[STRUCT[preferredFiatCurrency.storageKey]]) return bitcoin;
let sat = new BigNumber(bitcoin);
sat = sat.multipliedBy(100000000).toNumber();
let b = new BigNumber(bitcoin);
b = b
.multipliedBy(1)
.multipliedBy(lang[STRUCT[preferredFiatCurrency.storageKey]])
.toString(10);
b = parseFloat(b).toFixed(2);
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: preferredFiatCurrency.formatterValue,
minimumFractionDigits: 2,
});
return formatter.format(b);
return satoshiToLocalCurrency(sat);
}
function satoshiToBTC(satoshi) {

8
loc/index.js

@ -78,7 +78,7 @@ function removeTrailingZeros(value) {
/**
*
* @param balance {Number} Float amount of bitcoins
* @param unit {String} Value from models/bitcoinUnits.js
* @param toUnit {String} Value from models/bitcoinUnits.js
* @returns {string}
*/
strings.formatBalance = (balance, toUnit) => {
@ -95,6 +95,12 @@ strings.formatBalance = (balance, toUnit) => {
}
};
/**
*
* @param balance {Integer} Satoshis
* @param toUnit {String} Value from models/bitcoinUnits.js
* @returns {string}
*/
strings.formatBalanceWithoutSuffix = (balance, toUnit) => {
if (toUnit === undefined) {
return balance;

Loading…
Cancel
Save