microsoft / microsoft/TypeScript

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

オープン
#64,227 コメント 1 件 リアクション 1 件 担当者 2 名 GitHub で見る

@RyanCavanaugh がすでに取り組んでいます。

2026年9月19日 から。

  • #64346 @copilot-swe-agent による — オープン
Bug Domain: lib.d.ts Help Wanted Needs Human Review
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

⚙ Compilation target

ESNext

⚙ Library

ESNext

Missing / Incorrect Definition

https://github.com/microsoft/TypeScript/blob/0b832e12235cc3db14a4be6501827c2f8a8a8569/tsc/internal/bundled/libs/lib.esnext.temporal.d.ts#L320

Sample Code

TypeScript allows the following code, when it should not.

Temporal.Now.zonedDateTimeISO("America/Chicago").toLocaleString(undefined, { timeZone: "Europe/Berlin" });
Result
Engine Error
JavaScriptCore TypeError: ZonedDateTime.toLocaleString does not accept a timeZone option; the ZonedDateTime's time zone is used
SpiderMonkey TypeError: can't set option timeZone when Temporal.ZonedDateTime.toLocaleString is used
V8 TypeError: Invalid time zone specified: America/Chicago
Documentation Link

According to MDN:

The timeZone option must not be provided, as it is automatically set to be the date-time's timeZoneId.

The type definitions should be changed to

declare namespace Temporal {
  // ...
  interface ZonedDateTimeToLocaleStringOptions extends Omit<Intl.DateTimeFormatOptions, "timeZone"> {}
  // ...
  interface ZonedDateTime {
    // ...
    toLocaleString(locales?: Intl.LocalesArgument, options?: ZonedDateTimeToLocaleStringOptions): string;
  }
}

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。