set SEK format without decimals

This commit is contained in:
June 2023-08-11 18:46:33 +02:00
parent 585273ebc7
commit 92cb1b6174

View File

@ -1,9 +1,7 @@
import clsx from 'clsx';
const Price = ({
amount,
className,
currencyCode = 'USD',
currencyCode = 'SEK',
currencyCodeClassName
}: {
amount: string;
@ -12,12 +10,13 @@ const Price = ({
currencyCodeClassName?: string;
} & React.ComponentProps<'p'>) => (
<p suppressHydrationWarning={true} className={className}>
{`${new Intl.NumberFormat(undefined, {
{`${new Intl.NumberFormat('sv-SE', {
style: 'currency',
currency: currencyCode,
currencyDisplay: 'narrowSymbol'
currencyDisplay: 'narrowSymbol',
minimumFractionDigits: 0,
maximumFractionDigits: 0
}).format(parseFloat(amount))}`}
<span className={clsx('ml-1 inline', currencyCodeClassName)}>{`${currencyCode}`}</span>
</p>
);