DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

How to Format Dates for Different Calendars and Locales in JavaScript

Use Intl.DateTimeFormat to present JavaScript dates using the locale, calendar, numbering system, and time zone your application needs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use JavaScript’s built-in Intl.DateTimeFormat to format dates for a user’s locale, calendar, numbering system, and time zone. Pass a BCP 47 locale such as en-GB and set the options your application needs; avoid building localized strings by joining date fields with hard-coded punctuation.

Start with a locale-aware formatter

A locale affects conventions such as language and field order: for example, U.S. and U.K. English commonly display dates in different orders. Give the formatter the interface locale, rather than assuming that every user expects month/day/year.

As an Amazon Associate I earn from qualifying purchases.

const instant = new Date("2026-10-04T12:00:00Z");

const formatter = new Intl.DateTimeFormat("fr-FR", {
  dateStyle: "full",
  calendar: "gregory",
  timeZone: "Europe/Paris",
});

console.log(formatter.format(instant));

The result is a localized string for the requested settings. Exact punctuation, spacing, and other presentation details can differ between runtimes. MDN’s constructor reference documents the available locale and formatting options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the calendar and numbering system

Calendar

A locale has a default calendar, but you can request another with the calendar option. Common values include gregory, persian, and chinese. You can also specify a calendar in the locale’s Unicode extension, such as ja-JP-u-ca-japanese. If both the locale extension and the calendar option specify a calendar, the option takes precedence.

const formatter = new Intl.DateTimeFormat("en-US", {
  dateStyle: "long",
  calendar: "persian",
  timeZone: "UTC",
});

Use an explicit calendar when the application requires one rather than relying on a locale default. Where supported, Intl.supportedValuesOf("calendar") can list calendar types available in the runtime.

Numbering system

To request a particular digit system, use numberingSystem or the locale’s nu Unicode extension. An explicit option takes precedence over the extension; otherwise, the locale determines the default.

const formatter = new Intl.DateTimeFormat("ar-EG", {
  dateStyle: "long",
  numberingSystem: "arab",
  timeZone: "UTC",
});

Set the time zone deliberately

A JavaScript Date represents an instant. Formatting that instant in another time zone changes the displayed clock time and can change the displayed calendar day; it does not change the stored instant. If you omit timeZone, the runtime’s default time zone is used, so the same date can display differently on different devices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use "UTC" for output that must be stable across machines, such as reproducible logs or tests.
  • Use an IANA zone such as "America/New_York" or "Europe/Paris" when the display should follow a particular region.
  • Omit the option only when the user’s runtime-local time zone is intentionally the desired behavior.

To include a zone name, request timeZoneName. The localized name may fall back to another form, so do not rely on one exact text label in every runtime. See MDN’s JavaScript internationalization guide for the distinction between an instant and its localized display.

Select a preset or specific fields

For common levels of detail, use dateStyle and timeStyle with "full", "long", "medium", or "short". The locale determines how those styles are presented.

const dateFormatter = new Intl.DateTimeFormat("en-GB", {
  dateStyle: "medium",
  timeZone: "UTC",
});

For precise control over displayed fields, request components such as weekday, year, month, day, hour, and minute instead:

const dateFormatter = new Intl.DateTimeFormat("en-GB", {
  weekday: "long",
  day: "numeric",
  month: "long",
  year: "numeric",
  timeZone: "UTC",
});

Do not combine dateStyle or timeStyle with individual date or time component options in the same options object.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build formatters consistently

If your application needs a predictable default time zone but permits a caller to override it, place defaults before the caller’s options:

function makeDateFormatter(locale, options = {}) {
  return new Intl.DateTimeFormat(locale, {
    dateStyle: "medium",
    timeZone: "UTC",
    ...options,
  });
}

const formatter = makeDateFormatter("en-GB", { calendar: "gregory" });
console.log(formatter.format(new Date("2026-10-04T12:00:00Z")));

Here, UTC is the default, while a supplied timeZone in options overrides it. If the product instead follows each user’s local zone, omit the default intentionally.

Use structured parts instead of parsing the string

format() returns a localized string, not a stable template with guaranteed separators. Do not split it on commas, slashes, or spaces to rearrange fields. Use formatToParts() when you need to wrap or style individual pieces while preserving locale-selected order and literals.

const formatter = new Intl.DateTimeFormat("en-GB", {
  dateStyle: "long",
  timeZone: "UTC",
});

const parts = formatter.formatToParts(new Date("2026-10-04T12:00:00Z"));

for (const part of parts) {
  if (part.type === "day") {
    console.log("Day:", part.value);
  }
}

Parts have a type and a localized value; preserve the returned order and literals when reconstructing output. See MDN’s formatToParts() reference and its format() reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check locale negotiation and runtime defaults

When locale support or defaults matter, inspect what the runtime will actually use rather than assuming it honored every preference.

const requested = ["fr-FR", "fr"];
const supported = Intl.DateTimeFormat.supportedLocalesOf(requested);

const formatter = new Intl.DateTimeFormat(requested, {
  dateStyle: "full",
  timeZone: "UTC",
});

console.log(supported);
console.log(formatter.resolvedOptions());

supportedLocalesOf() reports requested locales supported without falling back to the runtime’s default locale. resolvedOptions() shows the formatter’s negotiated locale, calendar, numbering system, and time zone. References: supportedLocalesOf() and resolvedOptions().

MDN describes Intl.DateTimeFormat as broadly available across browsers since September 2017, but that baseline does not guarantee identical support for every newer option in every target runtime. Check compatibility for the specific features your application depends on. MDN’s API overview provides the general reference.

Keep date-only values distinct from instants

Because Date represents an instant rather than a date-only value, converting a timestamp for display in a different time zone can move it to the previous or next calendar day. Calendar selection also affects which calendar fields are presented. Decide what the underlying value means before formatting it: an event timestamp, a user-local appointment, and a date such as a birthday do not necessarily have the same time-zone requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For Temporal inputs, additional rules apply: a Temporal.ZonedDateTime should use its own toLocaleString() or be converted appropriately, and non-ISO Temporal calendar values generally require a matching explicit calendar option.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.