-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
fs: add Temporal.Instant support to Stats and BigIntStats
#60789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
It might be better to have this as a switchable option similar to |
Converting from
These properties are lazy-loaded, so the overhead when not used should be minimal. |
| // TODO(LiviaMedeiros): TemporalInstant primordial | ||
| return new Temporal.Instant(BigInt(MathFloor(msec / kMsPerSec)) * kNsPerSecBigInt + BigInt(nsec)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're probably going to want to support building node without Temporal support for a while
| // TODO(LiviaMedeiros): TemporalInstant primordial | |
| return new Temporal.Instant(BigInt(MathFloor(msec / kMsPerSec)) * kNsPerSecBigInt + BigInt(nsec)); | |
| if (Temporal == null) throw 'informative error'; | |
| // TODO(LiviaMedeiros): TemporalInstant primordial | |
| return new Temporal.Instant(BigInt(MathFloor(msec / kMsPerSec)) * kNsPerSecBigInt + BigInt(nsec)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, especially with mandatory Rust requirements.
Added the error, the message text is subject to changes (if this may land before enabling Temporal by default, it should also suggest --harmony-temporal flag)
| return this.atimeInstant = instantFromTimeSpecMs(this.atimeMs, this[kPartialAtimeNs]); | ||
| }, | ||
| set(value) { | ||
| ObjectDefineProperty(this, 'atimeInstant', { __proto__: null, value, writable: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ObjectDefineProperty(this, 'atimeInstant', { __proto__: null, value, writable: true }); | |
| setOwnProperty(this, 'atimeInstant', value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this will make the property enumerable, even though the initial getter is not? I don't mind it, but this better be aligned with how Date setters behave.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add an additional optional enumerable argument to setOwnProperty
Refs: #57891
This is a very rough draft, and probably shouldn't land until
Temporalimplementation is finalized and/or enabled by default.Opening early to see if there are any objections, suggestions to naming (the
*Instantproperties are facing userspace and having consistent convention would be nice), or to implementation.