mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 22:16:58 +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 = ({
|
const Price = ({
|
||||||
amount,
|
amount,
|
||||||
className,
|
className,
|
||||||
currencyCode = 'USD',
|
currencyCode = 'SEK',
|
||||||
currencyCodeClassName
|
currencyCodeClassName
|
||||||
}: {
|
}: {
|
||||||
amount: string;
|
amount: string;
|
||||||
@ -12,12 +10,13 @@ const Price = ({
|
|||||||
currencyCodeClassName?: string;
|
currencyCodeClassName?: string;
|
||||||
} & React.ComponentProps<'p'>) => (
|
} & React.ComponentProps<'p'>) => (
|
||||||
<p suppressHydrationWarning={true} className={className}>
|
<p suppressHydrationWarning={true} className={className}>
|
||||||
{`${new Intl.NumberFormat(undefined, {
|
{`${new Intl.NumberFormat('sv-SE', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: currencyCode,
|
currency: currencyCode,
|
||||||
currencyDisplay: 'narrowSymbol'
|
currencyDisplay: 'narrowSymbol',
|
||||||
|
minimumFractionDigits: 0,
|
||||||
|
maximumFractionDigits: 0
|
||||||
}).format(parseFloat(amount))}`}
|
}).format(parseFloat(amount))}`}
|
||||||
<span className={clsx('ml-1 inline', currencyCodeClassName)}>{`${currencyCode}`}</span>
|
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user