Skip to content

Fix filter node blocking every Date payload - #5990

Merged
knolleary merged 1 commit into
node-red:mainfrom
sarmah-rup:fix/compare-objects-dates
Oct 13, 2026
Merged

knolleary merged 1 commit into
node-red:mainfrom
sarmah-rup:fix/compare-objects-dates

Conversation

@sarmah-rup

@sarmah-rup sarmah-rup commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Fixes #5987

util.compareObjects treated any two Date objects as equal, because a Date has no own enumerable keys and fell through to the plain object branch. So the filter node in "block unless value changes" mode blocked every Date payload after the first.

This adds a Date check next to the existing Buffer check and compares them with getTime(). A Date compared with a non-Date is not equal. Two Dates with the same time are still equal.

Tests: one case in util_spec.js for compareObjects, and one in rbe_spec.js that sends the same Date twice and then a new one, and checks that only the first and the new one pass. Both fail without the change.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

compareObjects treated any two Date objects as equal because a Date has
no own enumerable keys. This made the filter (rbe) node block every
Date payload, including the first one.
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: sarmah-rup / name: Rup Sarmah (3a33638)

@dceejay

dceejay commented Oct 11, 2026

Copy link
Copy Markdown
Member

Looks good to me. But again will leave final decision to @knolleary as it is potentially breaking even though IMHO it is an improvement and is a fix.

@sarmah-rup

Copy link
Copy Markdown
Contributor Author

Thanks! On the breaking side: before this, the filter node passed the first Date and then blocked every Date after it, whatever the value. Two Dates with the same time are still treated as equal, so a flow that resends the same timestamp still gets filtered.

@dceejay

dceejay commented Oct 11, 2026

Copy link
Copy Markdown
Member

Yes - I agree, but in theory some people may have some really obscure use case where they stumbled across that behaviour and rely on it... (or didn't realise it was happening but still rely on it). But yes I agree that the point of the node is pass through objects with properties that change value so it's a fix to me.

@knolleary
knolleary merged commit cd7d82a into node-red:main Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter node (block unless value changes) treats every Date payload as unchanged

3 participants