nodejs / nodejs/node

Support `Temporal` across Node.js APIs

オープン
#57,891 コメント 6 件 リアクション 53 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature request never-stale
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

The Temporal proposal is currently Stage 3, has in progress / experimental implementation in V8 (available in latest releases using --harmony-temporal), and is likely to be unflagged in Node.js once it's stable enough (refs: https://github.com/nodejs/node/issues/57127, https://github.com/nodejs/node/pull/57128).

In light of this, I propose that Node.js begins supporting Temporal in the relevant APIs (mainly those that already work with Dates) after it becomes available by default without runtime flag.

Relevant APIs:

  • fs: Stats and BigIntStats
    Only bigint version provides nanosecond precision, and both provide lazy getters for Date instances. Adding lazy getters for Temporal.Instant would also make non-bigint version provide nanosecond precision.
  • fs: utimes(), lutimes(), futimes(), utimesSync(), lutimesSync(), futimesSync(), promises.utimes(), promises.lutimes(), filehandle.utimes()
    Accepts atime and mtime as number|string|Date, can support Temporal.Instant as well.
    Note: these functions also don't accept bigints yet. In the Temporal API, numbers are used for epochTimes in milliseconds while bigints are used for nanoseconds. Adding direct support of bigints might result a confusing API: some users might expect it to coerce type and behave exactly the same as number|string, some might expect it to be parsed as nanoseconds. Adding Temporal support would make it unambiguous.

Maybe there are other APIs that can benefit from this, too?
cc @nodejs/fs since it's only https://github.com/nodejs/node/labels/fs at the moment.

Internal updates (if it happens to be more precise, more fast, or more readable), generic support (primordials, util, assert, etc.) and dependencies (for example, undici.setCookie(, { expires })) are out of scope here.

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

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

はじめの一歩

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

調査の方向性

まず、一覧にある fs API、それらの既存の Date 処理、およびリンクされた Temporal 提案と Node.js リファレンスを確認します。何かを変更する前に、サポートする API の範囲と互換性の要件を定義してください。完了とは、合意した Temporal サポートが実装され、関連する fs テストでカバーされている状態を指しますが、ここでは具体的なファイルやテストは指定されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, nodejs
領域
api, operating-systems
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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