Skip to content

Commit

Permalink
Closes hql287#190, Closes hql287#173
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkSmile92 committed Jan 23, 2018
1 parent a608f67 commit 4ef3284
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/helpers/number.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
const appConfig = require('electron').remote.require('electron-settings');

function roundValue(value) {
// This variable my get value from setting in future version
const decimals = 2;
return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
}

function formatNumber(number) {
return roundValue(number).toLocaleString();
function formatNumber(number, locale) {
if (!locale) {
locale = appConfig.get('general.language') || 'en';
}
return roundValue(number).toLocaleString(locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
}

export { formatNumber };

0 comments on commit 4ef3284

Please sign in to comment.