17 lines
442 B
TypeScript
17 lines
442 B
TypeScript
const priceFormatter = new Intl.NumberFormat('sv-SE', {
|
|
style: 'currency',
|
|
currency: 'SEK',
|
|
minimumFractionDigits: 0,
|
|
maximumFractionDigits: 0,
|
|
})
|
|
|
|
export const formatPrice = (price: number) => priceFormatter.format(price)
|
|
|
|
const numberFormatter = new Intl.NumberFormat('sv-SE', {
|
|
style: 'decimal',
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2,
|
|
})
|
|
|
|
export const formatNumber = (nbr: number) => numberFormatter.format(nbr)
|