ECMAScript Internationalization API (Intl)
JavaScript's built-in locale toolkit: give it a locale tag and it formats dates, numbers, currency, lists, and plurals the local way.
See it
What it is
Intl is the formatting toolkit already sitting in every browser and in Node. You hand a constructor a locale tag and it hands back a formatter that speaks that region's conventions. The useful ones: Intl.DateTimeFormat, Intl.NumberFormat (numbers, percents, currency, compact notation, units), Intl.RelativeTimeFormat ('3 days ago'), Intl.ListFormat ('a, b, and c'), Intl.PluralRules, Intl.Collator (locale-correct sorting), Intl.DisplayNames (language and region names), and Intl.Segmenter (real characters, words, sentences).
Reach for it before you install anything. The data behind it is CLDR, the same Unicode dataset the heavy libraries bundle, except here it ships with the runtime and costs you zero kilobytes. A hand-rolled 'add a comma every three digits' helper is a bug waiting for its first Indian or German user.
Two gotchas. Constructing a formatter is expensive and formatting with it is cheap, so build it once outside your render loop, not per row of a table. And never assert on exact output strings in tests: engines update their CLDR data, and several locales use U+202F (narrow no-break space) where you typed a normal space, so your equality check fails for reasons invisible on screen.
Ask AI for it
Replace the hand-rolled formatting helpers in this codebase with the native Intl API. Create a small module that memoizes formatter instances by locale and options, exposing formatDate (Intl.DateTimeFormat with dateStyle/timeStyle), formatNumber and formatCurrency (Intl.NumberFormat), formatRelative (Intl.RelativeTimeFormat), and formatList (Intl.ListFormat). Take the locale from the app's active locale rather than the browser default, construct each formatter once instead of per call, and delete any manual comma-insertion or padStart date logic it replaces.