Introduction¶
Cosmo formats money, dates, numbers, units, and text using the conventions of a locale. Set a locale and, for date and time formatting, a time zone, then call the formatter you need.
Cosmo uses ICU for locale data and formatting:
import { Cosmo } from "@miloun/cosmo";
const c = new Cosmo("es-ES");
c.money(11000.4, "EUR"); // "11.000,40 €"
c.percentage(0.2); // "20%"
Locale data from ICU¶
Cosmo reads locale data from ICU rather than maintaining its own tables.
The library accesses ICU through the standard Intl API. Parsing,
transliteration, and rule-based number formatting are not exposed by that API.
See Platform notes for supported features and limitations.
Next steps¶
- Getting started — install and your first formatted value
- Guide — every feature, with side-by-side examples
- API reference — the complete method list
- Feature parity — what's available where