Skip to content

Commit

Permalink
[core] Properly divide MXN cents by 100 for display (#14075)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 6aad48708e3da0b34ed11710330b4a268e7abb78
  • Loading branch information
coreymartin authored and Lightspark Eng committed Dec 8, 2024
1 parent 814ebda commit f17fd07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/utils/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,10 @@ export function formatCurrencyStr(
let { value: num } = currencyAmount;
const { unit } = currencyAmount;

/* Currencies should always be represented in the smallest unit, e.g. cents for USD: */
if (unit === CurrencyUnit.USD) {
const centCurrencies = [CurrencyUnit.USD, CurrencyUnit.MXN] as string[];
/* Currencies are always provided in the smallest unit, e.g. cents for USD. These should be
* divided by 100 for proper display format: */
if (centCurrencies.includes(unit)) {
num = num / 100;
}

Expand Down

0 comments on commit f17fd07

Please sign in to comment.