Skip to content

How to evaluate the date in a rule? #409

Closed Answered by Ben-CA
Ben-CA asked this question in Q&A
Discussion options

You must be logged in to vote

Looks like I can just add the current date as a fact:

currentDate: new Date().toISOString().split('T')[0]

And then reference that in my rule as so:

{
  "all": [
    {
      "fact": "currentDate",
      "path": "",
      "value": "2025-01-29",
      "operator": "greaterThan"
    }
  ]
}

Seems to work just fine. :)

Note - there can be some time zone issues with UTC dates, in case anyone is referring to this in the future.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@chris-pardy
Comment options

@Ben-CA
Comment options

@chris-pardy
Comment options

@Ben-CA
Comment options

@chris-pardy
Comment options

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