From f17fd07ff43fc163f425890dfad931f028cb61f0 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Sun, 8 Dec 2024 13:41:37 -0800 Subject: [PATCH] [core] Properly divide MXN cents by 100 for display (#14075) GitOrigin-RevId: 6aad48708e3da0b34ed11710330b4a268e7abb78 --- packages/core/src/utils/currency.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/utils/currency.ts b/packages/core/src/utils/currency.ts index f8751b2b..d589049b 100644 --- a/packages/core/src/utils/currency.ts +++ b/packages/core/src/utils/currency.ts @@ -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; }