diff --git a/packages/huma-shared/src/utils/number.ts b/packages/huma-shared/src/utils/number.ts index e935a77a..0921c47a 100644 --- a/packages/huma-shared/src/utils/number.ts +++ b/packages/huma-shared/src/utils/number.ts @@ -38,6 +38,8 @@ export const formatMoneyFixed = ( return num } + toFixed = Number(num) === 0 ? 0 : toFixed + const numCast = Number(num) const moneyFormatter = new Intl.NumberFormat('en-US', { style: 'currency', @@ -77,6 +79,8 @@ export const formatNumberFixed = ( return num } + toFixed = Number(num) === 0 ? 0 : toFixed + const numberFormatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: toFixed, minimumFractionDigits: toFixed,