Skip to content
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

operator greaterThan, lessThan not working properly for Date. It is only comparing day part, but not considering month and year while comparing #375

Open
PundhirChetan opened this issue Oct 9, 2024 · 1 comment

Comments

@PundhirChetan
Copy link

it not working on date(json-rules-engine-6.5.0).
greaterThan working only on date’s day, it is not considering month and year. Let say datefield ABC value is “05 Apr 2022“, and we configure condition "if value “06 Apr 2021“ greaterThan ABC", then it is true as per library. Similarly, “04 Apr 2024“ greaterThan ABC is false as it only compare “04“ with “05“ and neglecting month and year part in comparison of dates.

{"conditions":{"any":[{"fact":"SomeProperty","tabnum":"1","value":"06-Sep-2024","operator":"greaterThan"}]}}

@chris-pardy
Copy link
Collaborator

This is because these do numeric comparisons. Convert the facts to timestamps before comparing them.

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

No branches or pull requests

2 participants