Skip to content

Commit

Permalink
Merge pull request #29 from ponimas/hungary
Browse files Browse the repository at this point in the history
Fix decimals for Hungary
  • Loading branch information
ponimas authored Apr 25, 2022
2 parents 8e0724d + 0a30de7 commit 79d6a8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exports.formattingForLocale = function (locale, currencyCode) {

const subunitsPerUnit = 100; // TODO change 100 with real information
return {
showDecimalIfWhole: true,
showDecimalIfWhole: 'HU' !== localeParts[LOCALE_REGION],
subunitsPerUnit,
centsZeroFill: String(subunitsPerUnit).length - 1,
currencyCode: currencyCode,
Expand Down
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,10 @@ describe('banknote', function () {
assert.equal(banknote.formatSubunitAmount(123400, options), '1.234 €');
});

it('should correctly hide decimal when in Hungary', function () {
const options = banknote.formattingForLocale('hu-HU');
assert.equal(banknote.formatSubunitAmount(12300, options), '123 Ft');
});

});
});

0 comments on commit 79d6a8d

Please sign in to comment.