From a46ab03fa719f6223d613a4e5b4eedcb6b124d6c 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 | 12 ++ doc/api/fs.md | 37 +++++- lib/internal/errors.js | 2 + lib/internal/fs/utils.js | 166 ++++++++++++++++++++++-- test/parallel/test-fs-stat-temporal.mjs | 105 +++++++++++++++ test/parallel/test-fs-watchfile.js | 12 +- 6 files changed, 315 insertions(+), 19 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..2ecd159496588e 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2465,6 +2465,17 @@ 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 +4483,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..884e5935219b67 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. +An attempt was made to use features that require [`Temporal`][], but Node.js was not +compiled with `Temporal` support or it has been disabled in the current environment +(for example, when running with `--no-harmony-temporal`). From 4faf47676f03316ddc7d43b03bcebf733956b414 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Mon, 18 May 2026 21:24:31 +0800 Subject: [PATCH 6/6] squash: adjust error message --- lib/internal/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 615443851448a8..f989bc8fe60a6e 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1640,7 +1640,7 @@ E('ERR_NO_CRYPTO', E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_NO_TEMPORAL', - 'Node.js is not compiled with Temporal support', Error); + 'Temporal is not supported in this environment', Error); E('ERR_NO_TYPESCRIPT', 'Node.js is not compiled with TypeScript support', Error); E('ERR_OPERATION_FAILED', 'Operation failed: %s', Error, TypeError);