Format dates, numbers and lists with Intl

8 steps · about 2 h 34 min · Intermediate

  1. Understand the internationalization namespace (guide, MDN Web Docs, 22 min)

    Learn the shared locale negotiation and options model behind the formatter classes.

  2. Canonicalize requested locales (reference, MDN Web Docs, 14 min)

    Normalize locale identifiers before storing preferences or constructing formatters.

  3. Format dates with an explicit zone (reference, MDN Web Docs, 24 min)

    Avoid machine-dependent date output by declaring the intended date fields and time zone.

  4. Format numbers, currency and units (reference, MDN Web Docs, 24 min)

    Apply locale-aware separators, precision, currency and unit display without string surgery.

  5. Express relative time (reference, MDN Web Docs, 18 min)

    Produce phrases such as yesterday or in two weeks with the locale's grammar.

  6. Join human-readable lists (reference, MDN Web Docs, 16 min)

    Use locale-appropriate conjunctions and punctuation for dynamic item lists.

  7. Select plural message branches (reference, MDN Web Docs, 18 min)

    Separate plural-category selection from translated message text instead of assuming singular and plural only.

  8. Inspect locale capabilities (reference, MDN Web Docs, 18 min)

    Resolve language, script, region, calendar and numbering preferences without parsing tags by hand.