Repository navigation
assert,util: compare Temporal objects by value - #67059
Open
pdeveltere wants to merge 3 commits into
Open
pdeveltere wants to merge 3 commits into
pdeveltere wants to merge 3 commits into
Conversation
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
Temporal objects keep their state in internal slots and have no own properties, so deep equality considered any two Temporal objects of the same type equal, e.g. two different Temporal.Instant values. Compare builtin Temporal objects with their `equals` method, and Temporal.Duration (which has no `equals`) field by field, the same way Date objects are compared by their time value. Signed-off-by: Pieter Develtere <pieterdeveltere@gmail.com>
pdeveltere
force-pushed
the
assert-deep-temporal
branch
from
October 27, 2026 14:25
89b6910 to
7aa1149
Compare
pdeveltere
marked this pull request as ready for review
October 27, 2026 20:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
assert.deepStrictEqual(),assert.deepEqual(),assert.partialDeepStrictEqual()andutil.isDeepStrictEqual()consider any two Temporal objects of the same type equal, because Temporal objects keep their state in internal slots and have no own properties:Dateobjects are compared by their time value for the same reason. This compares builtin Temporal objects with theirequalsmethod, andTemporal.Duration(which has noequals) field by field, soPT1HandPT60Mare not equal. An object that only carries aTemporal.*tag is never equal to a builtin Temporal object.The type checks come from
internal/util/temporal, added in #63312, so this PR is stacked on it and its first commits are from that PR. Onlyassert,util: compare Temporal objects by valueand its fixup belong to this PR. It stays a draft until #63312 lands; I'll rebase onmainthen.Refs: #63312