Skip to content

Commit

Permalink
feat(format): extend native Intl options
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementParis016 committed Aug 5, 2021
1 parent d3a3f0a commit d455a13
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export const enum CurrencySign {
* @public
* The options that can be passed to {@link format} or {@link unsafeFormat} to tweak to formatting.
*/
export interface MonetaryValueFormatOptions {
export interface MonetaryValueFormatOptions
extends Omit<
Intl.NumberFormatOptions,
'style' | 'currency' | 'minimumFractionDigits' | 'maximumFractionDigits'
> {
/**
* The locale matching algorithm to use.
* For more information, see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
Expand All @@ -90,10 +94,6 @@ export interface MonetaryValueFormatOptions {
* Determines how to display the currency part of the string.
*/
currencyDisplay?: CurrencyDisplay;
/**
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators.
*/
useGrouping?: boolean;
/**
* @alpha
* Determines in which situation the sign should be displayed.
Expand Down Expand Up @@ -165,9 +165,7 @@ export function nativeFormat<C extends string>(
unsafeToNumber(monetaryValue),
locales,
{
localeMatcher: formatOptions.localeMatcher,
currencyDisplay: formatOptions.currencyDisplay,
useGrouping: formatOptions.useGrouping,
...formatOptions,
style: 'currency',
currency: monetaryValue.currency,
minimumFractionDigits: monetaryValue.precision,
Expand Down

0 comments on commit d455a13

Please sign in to comment.