Skip to content

Commit

Permalink
feat: add exports of Intl.NumberFormat objects
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-anderson committed Feb 20, 2024
1 parent 5f99a30 commit 17ae491
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/app/localization/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Intl API objects
*/
export const i18nFormats = {
enUS: {
number: {
currency: new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
maximumFractionDigits: 2,
}),
currencyRounded: new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
maximumFractionDigits: 0,
}),
percentage: new Intl.NumberFormat("en-US", { style: "percent" }),
},
},
} as const;

/**
* Supported locales (currently only `enUS`)
*/
export type SupportedLocale = keyof typeof i18nFormats;

0 comments on commit 17ae491

Please sign in to comment.