From 65d3bb81cf3932ee6dc8c1a921d289a1ea83b8ee Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Thu, 20 Nov 2025 12:30:49 +0800 Subject: [PATCH 1/6] fs: add `Temporal.Instant` support to `Stats` and `BigIntStats` Signed-off-by: LiviaMedeiros --- doc/api/errors.md | 8 ++ doc/api/fs.md | 37 +++++- lib/internal/errors.js | 2 + lib/internal/fs/utils.js | 146 ++++++++++++++++++++++-- test/parallel/test-fs-stat-temporal.mjs | 94 +++++++++++++++ test/parallel/test-fs-watchfile.js | 12 +- 6 files changed, 282 insertions(+), 17 deletions(-) create mode 100644 test/parallel/test-fs-stat-temporal.mjs diff --git a/doc/api/errors.md b/doc/api/errors.md index f2aafb1b165ca7..34dcfa350fdf1b 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2465,6 +2465,13 @@ OpenSSL crypto support. An attempt was made to use features that require [ICU][], but Node.js was not compiled with ICU support. + + +### `ERR_NO_TEMPORAL` + +An attempt was made to use features that require [`Temporal`][], but Node.js was +compiled with `Temporal` support disabled. + ### `ERR_NO_TYPESCRIPT` @@ -4472,6 +4479,7 @@ An error occurred trying to allocate memory. This should never happen. [`QuicError`]: quic.md#class-quicerror [`REPL`]: repl.md [`ServerResponse`]: http.md#class-httpserverresponse +[`Temporal`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal [`Writable`]: stream.md#class-streamwritable [`child_process`]: child_process.md [`cipher.getAuthTag()`]: crypto.md#ciphergetauthtag diff --git a/doc/api/fs.md b/doc/api/fs.md index c5e908aaa39f6c..4c92eec2093fa2 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4799,7 +4799,11 @@ Stats { atime: 2019-06-22T03:37:33.072Z, mtime: 2019-06-22T03:36:54.583Z, ctime: 2019-06-22T03:37:06.624Z, - birthtime: 2019-06-22T03:28:46.937Z + birthtime: 2019-06-22T03:28:46.937Z, + atimeInstant: 2019-06-22T03:37:33.071963Z, + mtimeInstant: 2019-06-22T03:36:54.5833518Z, + ctimeInstant: 2019-06-22T03:37:06.6235366Z, + birthtimeInstant: 2019-06-22T03:28:46.9372893Z } false Stats { @@ -4820,7 +4824,11 @@ Stats { atime: 2019-06-22T03:36:56.619Z, mtime: 2019-06-22T03:36:54.584Z, ctime: 2019-06-22T03:36:54.584Z, - birthtime: 2019-06-22T03:26:47.711Z + birthtime: 2019-06-22T03:26:47.711Z, + atimeInstant: 2019-06-22T03:36:56.6188555Z, + mtimeInstant: 2019-06-22T03:36:54.584Z, + ctimeInstant: 2019-06-22T03:36:54.5838145Z, + birthtimeInstant: 2019-06-22T03:26:47.7107478Z } ``` @@ -7525,6 +7533,9 @@ i.e. before the `'ready'` event is emitted. + An attempt was made to use features that require [`Temporal`][], but Node.js was compiled with `Temporal` support disabled.