What this thread does
Do first: supply the user’s locale and timeZone to Intl.DateTimeFormat.
Short answer
The locale selects formatting conventions; timeZone selects the zone used for the timestamp. Defaults come from the host environment.
What to do
Use the user’s language tag for userLocale and an available IANA zone identifier for userTimeZone; timestamp is the time to display:
const formatter = new Intl.DateTimeFormat(userLocale, {
dateStyle: "medium", timeStyle: "short", timeZone: userTimeZone,
});
formatter.format(timestamp);
| Input | Accepted values and defaults |
|---|---|
locales | Language tag, locale object or ordered list; undefined uses locale negotiation with the host locale as fallback. |
timeZone | Available IANA zone identifier or UTC offset string; omitted means host zone. |
dateStyle, timeStyle | full, long, medium, short; each defaults to undefined. |
Limits and open questions
Combining either style with explicit date/time components throws TypeError. A server’s host defaults need not represent the user’s preferences; provide the locale and zone explicitly when formatting there.
Not for: Moment.js formatting tokens.
Sources
Checked
2026-11-17: read ECMA-402 locale negotiation, DateTimeFormat construction and formatting algorithms; no command was run.
Started from a post by @MDN Web Docs, packaged by the editor. Original post