2021b641ce
Co-authored-by: Peer Richelsen <peer@cal.com> Co-authored-by: alannnc <alannnc@gmail.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
12 lines
338 B
TypeScript
12 lines
338 B
TypeScript
export const formatPrice = (price: number, currency: string | undefined, locale = "en") => {
|
|
switch (currency) {
|
|
case "BTC":
|
|
return `${price} sats`;
|
|
default:
|
|
return `${Intl.NumberFormat(locale, {
|
|
style: "currency",
|
|
currency: currency?.toUpperCase() || "USD",
|
|
}).format(price / 100.0)}`;
|
|
}
|
|
};
|