Skip to content
Discussion options

You must be logged in to vote

So I tried using it like:

engine.addOperatorDecorator('dateValue', (factValue, value, next) => next(factValue, new Date(value).getTime()));

And I'm setting a fact like:
currentDate = new Date().getTime();

If you log that, you get the ms since Unix epoch:
currentDate 1738883049146

And then a rule like:

{ "all": [ { "fact": "currentDate", "path": "", "value": "2025-02-05", "operator": "dateValue:greaterThan" } ] } 

And it works as expected with:
'lessThan', 'greaterThan'

But for most practical purposes, 'equal', 'notEqual', 'lessThanInclusive', 'greaterThanInclusive' are not going to be useful then, as you're essentially never going to be comparing exact…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@Ben-CA
Comment options

@chris-pardy
Comment options

@Ben-CA
Comment options

@chris-pardy
Comment options

@Ben-CA
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Ben-CA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants