Files
calendar/packages/lib/price.ts
T
Anik Dhabal BabuandGitHub dfa92f5cb6 fix: currency conversion error for paypal (#16917)
* fix: currency conversion error for paypal

* type-error
2024-10-05 01:11:09 +05:30

15 lines
532 B
TypeScript

import { convertFromSmallestToPresentableCurrencyUnit } from "@calcom/app-store/_utils/payments/currencyConversions";
export const formatPrice = (price: number, currency: string | undefined, locale = "en") => {
switch (currency) {
case "BTC":
return `${price} sats`;
default:
currency = currency?.toUpperCase() || "USD";
return `${Intl.NumberFormat(locale, {
style: "currency",
currency: currency,
}).format(convertFromSmallestToPresentableCurrencyUnit(price, currency))}`;
}
};