zig-js

Intl & Temporal

On this page 4

Both namespaces are implemented in pure Zig against checked-in data tables. There is no ICU dependency and no runtime data download: locale data, plural rules, number systems, time-zone rules, and unit data are generated into Zig source and compiled in.

The test/intl402 subtree — including its Temporal areas — is part of the configured test262 corpus, so both namespaces are scored on every run. See Conformance.

Intl

ConstructorPurpose
Intl.CollatorLocale-aware string comparison.
Intl.NumberFormatNumbers, currencies, units, notation, and formatToParts.
Intl.DateTimeFormatDates and times, including ranges and formatToParts.
Intl.RelativeTimeFormat"3 days ago" style formatting.
Intl.PluralRulesCardinal and ordinal plural category selection.
Intl.ListFormatConjunction / disjunction / unit list joining.
Intl.DisplayNamesNames for languages, regions, scripts, currencies, calendars.
Intl.SegmenterGrapheme, word, and sentence segmentation with containing.
Intl.DurationFormatDuration formatting.
Intl.LocaleLocale identifier parsing, maximize/minimize, and the getCalendars / getCollations / getHourCycles / getNumberingSystems / getTextInfo / getTimeZones / getWeekInfo accessors, plus firstDayOfWeek.

Namespace functions: Intl.getCanonicalLocales and Intl.supportedValuesOf.

Every constructor implements the standard resolution pipeline — option coercion, locale negotiation, and resolvedOptions() reporting what was actually selected.

Where the data comes from

TableSource module
Locale/likely-subtags datacldr_locale.zig
Number formats and symbolscldr_numbers.zig, numbering_systems.zig
Plural rulescldr_plurals.zig
Date/time patternscldr_timedata.zig
Time-zone aliasescldr_tzalias.zig
Zone rules and offsetsiana_zones.zig, iana_offsets.zig
Display namesintl_displaynames_data.zig
Locale info (text direction, week data)intl_localeinfo.zig, intl_weekdata.zig
Unitsintl_units_data.zig
Segmentationunicode_grapheme_data.zig

These are generated by the tools/gen_* scripts (gen_cldr_*.ts, gen_iana_offsets.ts, gen_dn.ts, gen_localeinfo.ts, gen_units.ts, gen_weekdata.ts, gen_numbering.ts, gen_grapheme.ts). TypeScript generators run through ~/Code/Home/lang/zig-out/bin/home-tool. Regenerate the tables from an upstream bump — never hand-edit the .zig tables.

Temporal

The Temporal namespace provides:

  • Temporal.Now
  • Temporal.Instant
  • Temporal.Duration
  • Temporal.PlainDate, Temporal.PlainTime, Temporal.PlainDateTime
  • Temporal.PlainYearMonth, Temporal.PlainMonthDay
  • Temporal.ZonedDateTime

Arithmetic, rounding, comparison, calendar and time-zone handling, and the ISO-8601 string round-trips are implemented against the same IANA tables that back Date and Intl.DateTimeFormat, so a zone answer is consistent across all three.

Keeping the data current

A time-zone or CLDR release changes real behaviour. When bumping:

  1. Re-run the relevant tools/gen_* generator against the new upstream release.
  2. Run the full corpus — test/intl402 and test/built-ins/Date are the sensitive subtrees.
  3. Record the flip count in the commit body, as with any conformance change.

See the contributing guide for the generated-file policy.