fix: avoid localizing currencies and default missing value to N/A
This commit is contained in:
@@ -16,17 +16,9 @@ export function getSingleDecimal(n: Number | string) {
|
||||
* @param currency - currency code
|
||||
* @returns localized and formatted number in string type with currency
|
||||
*/
|
||||
export function formatPrice(
|
||||
intl: IntlShape,
|
||||
price: number,
|
||||
currency?: string | null
|
||||
) {
|
||||
if (!currency) {
|
||||
return intl.formatNumber(price)
|
||||
}
|
||||
return intl.formatNumber(price, {
|
||||
style: "currency",
|
||||
currency,
|
||||
export function formatPrice(intl: IntlShape, price: number, currency: string) {
|
||||
const localizedPrice = intl.formatNumber(price, {
|
||||
minimumFractionDigits: 0,
|
||||
})
|
||||
return `${localizedPrice} ${currency}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user