Using the Intl Object in TypeScript: An Overview with Examples
I once hard-coded a date format as MM/DD/YYYY and shipped it to European users. They were confused. In most of the world, the month doesn't come first.
6 Jun 2024

I once hard-coded a date format as MM/DD/YYYY and shipped it to European users. They were confused. In most of the world, the month doesn't come first.
The Intl object solves this. It's built into JavaScript and TypeScript — no libraries needed. It formats numbers, dates, and lists according to the user's locale.
Number formatting
Intl.NumberFormat handles commas, decimals, currencies, and percentages based on locale:
const number = 1234567.89;
const usFormatter = new Intl.NumberFormat('en-US');
console.log(usFormatter.format(number)); // "1,234,567.89"
const deFormatter = new Intl.NumberFormat('de-DE');
console.log(deFormatter.format(number)); // "1.234.567,89"
Same number. Different locale. Different output.
Date formatting
Intl.DateTimeFormat formats dates the way each locale expects:
const date = new Date('2024-06-06T12:00:00Z');
const formatter = new Intl.DateTimeFormat('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
});
console.log(formatter.format(date)); // "Thursday, June 6, 2024"
Change 'en-US' to 'ja-JP' and you get Japanese date formatting. No string manipulation, no lookup tables.
List formatting
Intl.ListFormat joins arrays into human-readable lists:
const items = ['Apple', 'Orange', 'Banana'];
const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });
console.log(formatter.format(items)); // "Apple, Orange, and Banana"
In French, that becomes "Apple, Orange et Banana." The Intl object handles the conjunction rules for each language.
The trade-off
Intl is built-in, well-supported, and handles the hard parts of localization automatically. No moment.js, no date-fns for basic formatting.
The cost: browser support for newer APIs like ListFormat and RelativeTimeFormat varies. And Intl only handles formatting — it doesn't handle translations, pluralization rules, or complex i18n workflows. For that, you still need a library like i18next or react-intl.
For formatting numbers and dates? Intl is all you need.