Skip to content

Cast numeric filter values as number for _eq and _neq operators#16657

Merged
rijkvanzanten merged 3 commits intomainfrom
fix/numeric-eq-filters
Jan 6, 2023
Merged

Cast numeric filter values as number for _eq and _neq operators#16657
rijkvanzanten merged 3 commits intomainfrom
fix/numeric-eq-filters

Conversation

@licitdev
Copy link
Member

@licitdev licitdev commented Nov 28, 2022

Description

Fixes #16649 by allowing equality with the corresponding numeric values.

The filter value in filters are stored in the string format.
For example: { "year(updated_on)": { "_eq": "2023" } }

Hence when using _eq with year(), it fails validation as 2023 !== '2023'.

Added checks for null, "" and boolean values as such Number(<value>) becomes 0.

Fixes ENG-126

Type of Change

  • Bugfix
  • Improvement
  • New Feature
  • Refactor / codestyle updates
  • Other, please describe:

Requirements Checklist

  • New / updated tests are included
  • All tests are passing locally
  • Performed a self-review of the submitted code

If adding a new feature:

  • Documentation was added/updated. PR:

Copy link
Member

@br41nslug br41nslug left a comment

Choose a reason for hiding this comment

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

Good fix, works as expected 😄

@rijkvanzanten rijkvanzanten merged commit bcbbd81 into main Jan 6, 2023
@rijkvanzanten rijkvanzanten deleted the fix/numeric-eq-filters branch January 6, 2023 21:06
@rijkvanzanten rijkvanzanten added this to the Next Release milestone Jan 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date validation always invalidates input

3 participants