mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
set SEK format without decimals
This commit is contained in:
parent
585273ebc7
commit
92cb1b6174
@ -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>
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user