diff --git a/packages/theme-currency/currency.js b/packages/theme-currency/currency.js index 889b9b6..272b2d3 100644 --- a/packages/theme-currency/currency.js +++ b/packages/theme-currency/currency.js @@ -60,6 +60,9 @@ export function formatMoney(cents, format) { case 'amount_no_decimals_with_comma_separator': value = formatWithDelimiters(cents, 0, '.', ','); break; + case 'amount_with_apostrophe_separator': + value = formatWithDelimiters(cents, 2, "'", '.'); + break; } return formatString.replace(placeholderRegex, value); diff --git a/packages/theme-currency/currency.test.js b/packages/theme-currency/currency.test.js index 16fdbb3..adb3a4b 100644 --- a/packages/theme-currency/currency.test.js +++ b/packages/theme-currency/currency.test.js @@ -33,4 +33,12 @@ describe("currency.formatMoney", () => { ); expect(value).toBe("$10.000"); }); + + test(`Formats a number 1000001 to a string of "$10'000.01"`, () => { + const value = formatMoney( + 1000001, + "${{amount_with_apostrophe_separator}}" + ); + expect(value).toBe("$10'000.01"); + }); });