Use toLocaleString for currency formatting for more flexibility

This commit is contained in:
2025-01-27 14:10:24 +01:00
parent 5399000c8d
commit cd48cc3854

View File

@@ -1,12 +1,13 @@
<script>
export let symbol = "€"
export let amount = 0
export let precision = 2
</script>
<span>
{symbol}
<span class:red={amount < 0} class:green={amount > 0}>
{(amount / 1000000).toFixed(precision)}
{(amount / 1000000).toLocaleString(undefined, {minimumFractionDigits: precision, maximumFractionDigits: precision})}
</span>
</span>