sur Intl.NumberFormat to format currency in billing history

This commit is contained in:
m5r 2021-10-03 18:18:34 +02:00
parent dd9d15d042
commit 22e2b21b14

View File

@ -46,14 +46,17 @@ export default function BillingHistory() {
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{typeof payments !== "undefined"
? payments.map((payment) => (
{payments.map((payment) => (
<tr key={payment.id}>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<time>{new Date(payment.payout_date).toDateString()}</time>
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{payment.amount} {payment.currency}
{Intl.NumberFormat(undefined, {
style: "currency",
currency: payment.currency,
currencyDisplay: "narrowSymbol",
}).format(payment.amount)}
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{payment.is_paid === 1 ? "Paid" : "Upcoming"}
@ -71,8 +74,7 @@ export default function BillingHistory() {
) : null}
</td>
</tr>
))
: null}
))}
</tbody>
</table>
</div>