Support `Temporal` across Node.js APIs
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.4k
- Ø Merge
- 4 T. 3 Std.
- Gemergte PRs (30 T.)
- 272
Beschreibung
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:StatsandBigIntStats
Only bigint version provides nanosecond precision, and both provide lazy getters forDateinstances. Adding lazy getters forTemporal.Instantwould also make non-bigint version provide nanosecond precision. -
fs:utimes(),lutimes(),futimes(),utimesSync(),lutimesSync(),futimesSync(),promises.utimes(),promises.lutimes(),filehandle.utimes()
Acceptsatimeandmtimeasnumber|string|Date, can supportTemporal.Instantas well.
Note: these functions also don't acceptbigints yet. In the Temporal API,numbers are used forepochTimes in milliseconds whilebigints are used for nanoseconds. Adding direct support ofbigints might result a confusing API: some users might expect it to coerce type and behave exactly the same asnumber|string, some might expect it to be parsed as nanoseconds. AddingTemporalsupport 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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Überprüfung der aufgeführten fs APIs, ihrer bestehenden Date-Behandlung sowie des verlinkten Temporal-Vorschlags und der Node.js-Referenzen. Definiere die unterstützte API-Oberfläche und die Kompatibilitätserwartungen, bevor du irgendetwas änderst; abgeschlossen bedeutet, dass die vereinbarte Temporal-Unterstützung implementiert und durch die relevanten fs-Tests abgedeckt ist, obwohl hier keine bestimmten Dateien oder Tests genannt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- api, operating-systems
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100