Skip to content

fs: add Temporal.Instant support to Stats and BigIntStats#60789

Merged
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
LiviaMedeiros:fs-stats-temporal
May 18, 2026
Merged

fs: add Temporal.Instant support to Stats and BigIntStats#60789
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
LiviaMedeiros:fs-stats-temporal

Conversation

@LiviaMedeiros
Copy link
Copy Markdown
Member

Refs: #57891

This is a very rough draft, and probably shouldn't land until Temporal implementation is finalized and/or enabled by default.
Opening early to see if there are any objections, suggestions to naming (the *Instant properties are facing userspace and having consistent convention would be nice), or to implementation.

@LiviaMedeiros LiviaMedeiros added fs Issues and PRs related to the fs subsystem / file system. experimental Issues and PRs related to experimental features. labels Nov 20, 2025
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Nov 20, 2025
@Renegade334
Copy link
Copy Markdown
Member

Renegade334 commented Nov 20, 2025

Since Date.prototype.toInstant() comes along with Temporal, these are fairly trivial to obtain anyway? (Although come to think of it, this would lose nanosecond precision.)

It might be better to have this as a switchable option similar to bigint, rather than adding the overhead of building a load of Temporal objects for every stats call?

@LiviaMedeiros
Copy link
Copy Markdown
Member Author

Since Date.prototype.toInstant() comes along with Temporal, these are fairly trivial to obtain anyway?

Converting from Date would have performance overhead on top of precision loss.

It might be better to have this as a switchable option similar to bigint, rather than adding the overhead of building a load of Temporal objects for every stats call?

These properties are lazy-loaded, so the overhead when not used should be minimal.

Comment thread lib/internal/fs/utils.js Outdated
Comment thread lib/internal/fs/utils.js Outdated
@LiviaMedeiros LiviaMedeiros marked this pull request as ready for review May 14, 2026 20:07
Comment thread doc/api/fs.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 90.34483% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.07%. Comparing base (a9b0a83) to head (4faf476).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/fs/utils.js 90.20% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #60789    +/-   ##
========================================
  Coverage   90.06%   90.07%            
========================================
  Files         714      714            
  Lines      225629   225876   +247     
  Branches    42702    42742    +40     
========================================
+ Hits       203211   203448   +237     
+ Misses      14232    14205    -27     
- Partials     8186     8223    +37     
Files with missing lines Coverage Δ
lib/internal/errors.js 97.65% <100.00%> (+<0.01%) ⬆️
lib/internal/fs/utils.js 98.43% <90.20%> (-1.25%) ⬇️

... and 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread doc/api/fs.md Outdated
Comment thread lib/internal/fs/utils.js Outdated
LiviaMedeiros added a commit to LiviaMedeiros/node that referenced this pull request May 15, 2026
Comment thread doc/api/errors.md
@aduh95 aduh95 added semver-minor PRs that contain new features and should be released in the next minor version. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v25.x PRs that should not land on the v25.x-staging branch and should not be released in v25.x. labels May 15, 2026
Signed-off-by: LiviaMedeiros <livia@cirno.name>
Comment thread lib/internal/fs/utils.js Outdated
Comment thread lib/internal/fs/utils.js
Symbol,
TypedArrayPrototypeAt,
TypedArrayPrototypeIncludes,
globalThis,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
globalThis,
globalThis: {
Temporal,
},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this doesn't seem to work since at this point of bootstrapping Temporal is not defined yet.
Same goes for const { Temporal } = globalThis; on top level of the file.

Comment thread lib/internal/fs/utils.js
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Comment thread lib/internal/fs/utils.js Outdated
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Comment thread doc/api/errors.md Outdated
Comment thread lib/internal/errors.js Outdated
@LiviaMedeiros LiviaMedeiros added the request-ci Add this label to start a Jenkins CI on a PR. label May 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 18, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 18, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 18, 2026
@nodejs-github-bot nodejs-github-bot merged commit 4ee7567 into nodejs:main May 18, 2026
91 of 92 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in 4ee7567

aduh95 pushed a commit that referenced this pull request May 19, 2026
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: #60789
Refs: #57891
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
aduh95 pushed a commit that referenced this pull request May 19, 2026
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: #60789
Refs: #57891
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
nodejs-github-bot added a commit that referenced this pull request May 19, 2026
Notable changes:

doc:
  * mark stream.compose stable (Matteo Collina) #62562
fs:
  * (SEMVER-MINOR) add `Temporal.Instant` support to `Stats` and `BigIntStats` (Livia Medeiros) #60789
http:
  * (SEMVER-MINOR) add writeInformation to send arbitrary 1xx status codes (Tim Perry) #63155

PR-URL: #63440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. dont-land-on-v25.x PRs that should not land on the v25.x-staging branch and should not be released in v25.x. experimental Issues and PRs related to experimental features. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants