Support `Temporal` across Node.js APIs
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando le API fs elencate, la loro gestione esistente di Date e la proposta Temporal e i riferimenti a Node.js collegati. Definisci la superficie API supportata e le aspettative di compatibilità prima di modificare qualsiasi cosa; il lavoro è completo quando il supporto Temporal concordato è implementato e coperto dai test fs pertinenti, anche se qui non vengono indicati file o test specifici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, nodejs
- Ambito
- api, operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100