[TSM.ID].[11031972] PXE : Platform X Ecosystem I [118 Module -LIVE-]
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export type Currency = 'Rp' | 'USD' | 'Crypto';
|
||||
|
||||
export function formatCurrency(amountUSD: number, currency: Currency): string {
|
||||
if (currency === 'USD') {
|
||||
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(amountUSD);
|
||||
} else if (currency === 'Rp') {
|
||||
// 1 USD = 16000 Rp (Simulation)
|
||||
return new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR' }).format(amountUSD * 16000);
|
||||
} else if (currency === 'Crypto') {
|
||||
// 1 USD = 1 USDT
|
||||
return `${amountUSD.toFixed(2)} USDT`;
|
||||
}
|
||||
return amountUSD.toString();
|
||||
}
|
||||
Reference in New Issue
Block a user