Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed Jul 3, 2024
1 parent e21dc5d commit 0ceb032
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/shared/src/lib/core/i18n/utils/formatCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function formatCurrency(
convertedValue = Number(value.toFixed(2))
}

const isCurrencyNotSupported = currency.length > 3
const isCurrencyNotSupported = currency?.length > 3
if (isCurrencyNotSupported) {
const formattedValue = convertedValue.toLocaleString(appLanguage, {
minimumFractionDigits: 2,
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/lib/core/i18n/utils/getGroupSeparator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export function getGroupSeparator(currency: string | undefined = undefined): str
currency = get(activeProfile)?.settings?.marketCurrency
}

const isCurrencySupportedByIntl = currency?.length <= 3
return (
Intl.NumberFormat(appLanguage, {
style: 'currency',
currency: currency.length > 3 ? 'USD' : currency,
currency: isCurrencySupportedByIntl ? currency : 'USD',
})
.formatToParts(1111111)
.find((part) => part.type === 'group')?.value ?? ','
Expand Down

0 comments on commit 0ceb032

Please sign in to comment.