Format Price
This FormatPrice
Function is used for
formatting the prices along with comma and currency.
FormatPrie
formatPrice.ts
export const formatPrice = (value: number): string => {
if (!value) return
return new Intl.NumberFormat('mm-MM', {
maximumSignificantDigits: 3,
style: 'currency',
currency: 'MMK',
}).format(value)
}
Usage
product.tsx
const price = formatPrice(35000) // 35,000MMK
Last updated on April 6, 2023