Intl.DateTimeFormat resolvedOptions Reveals Defaults

Inspect the effective timeZone, calendar, numberingSystem, and hourCycle resolved by Intl.DateTimeFormat after applying locale extension tags.

JavascriptConfig Management

Code

snippet
const configs = [
  ['en-US-u-hc-h23', { dateStyle: 'short', timeStyle: 'short', timeZone: 'UTC' }],
  ['th-TH-u-ca-buddhist', { dateStyle: 'medium', timeZone: 'Asia/Bangkok' }],
  ['ar-EG-u-nu-arab', { dateStyle: 'medium', timeZone: 'Africa/Cairo' }],
];

for (const [locale, options] of configs) {
  const fmt = new Intl.DateTimeFormat(locale, options);
  const resolved = fmt.resolvedOptions();
  console.log(
    resolved.locale,
    '| tz:', resolved.timeZone,
    '| cal:', resolved.calendar,
    '| num:', resolved.numberingSystem,
    '| hc:', resolved.hourCycle ?? 'none',
  );
  console.log('  formatted:', fmt.format(new Date('2026-11-24T14:05:00Z')));
}

Output

Captured from a sandboxed run of this snippet in the build pipeline.

en-US-u-hc-h23 | tz: UTC | cal: gregory | num: latn | hc: h23
  formatted: 11/24/26, 14:05
th-TH-u-ca-buddhist | tz: Asia/Bangkok | cal: buddhist | num: latn | hc: none
  formatted: 24 พ.ย. 2569
ar-EG-u-nu-arab | tz: Africa/Cairo | cal: gregory | num: arab | hc: none
  formatted: ٢٤‏/١١‏/٢٠٢٦

Execution path — Intl.DateTimeFormat resolvedOptions Reveals Defaults

The loop for (const [locale, options] of configs) is the only repeated construct.

Demo state sits in top-level bindings: configs.

What to watch for

  • Zero-fetch snippet: every identifier resolves inside the language distribution.

Using it

Stdout messages arrive prefixed by — formatted: — when the file runs.

Key statements

const fmt = new Intl.DateTimeFormat(locale, options);

Interactive Tools for This Topic

FAQ

Does the code pull in any external packages?
No external packages are involved; every call resolves to a built-in API. Its state lives in module-level bindings: `configs`.