9 lines
305 B
TypeScript
9 lines
305 B
TypeScript
export function formatCurrency(price: number | bigint, locale ='en-US', currency = 'CZK'): string {
|
|
const currencyFormatter = new Intl.NumberFormat(locale, {
|
|
style: 'currency',
|
|
currency: currency,
|
|
maximumFractionDigits: 0,
|
|
});
|
|
|
|
return currencyFormatter.format(price).replace(',', ' ')
|
|
}
|