Skip to content

Reject timeZone in ZonedDateTime.toLocaleString options - #64346

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-temporal-zoned-datetime-options
Draft

Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-temporal-zoned-datetime-options

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Temporal.ZonedDateTime#toLocaleString always formats in the receiver’s time zone, so a caller-supplied timeZone is invalid.

Changes

  • Added Temporal.ZonedDateTimeToLocaleStringOptions, omitting Intl.DateTimeFormatOptions["timeZone"].
  • Updated ZonedDateTime#toLocaleString to use the new options type.
  • Updated the Temporal compiler baseline to diagnose invalid usage:
zdt.toLocaleString(undefined, { timeZone: "Europe/Berlin" });
//                               ~~~~~~~~ error

@typescript-automation typescript-automation Bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 19, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 19, 2026
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix illegal timeZone option in Temporal.ZonedDateTime Reject timeZone in ZonedDateTime.toLocaleString options Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The options arg of Temporal.ZonedDateTime.prototype.toLocaleString() currently accepts "illegal" option timeZone

2 participants