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

What would be the best way to build a rule based on date? #19

Open
fstn opened this issue Jan 7, 2021 · 1 comment
Open

What would be the best way to build a rule based on date? #19

fstn opened this issue Jan 7, 2021 · 1 comment

Comments

@fstn
Copy link

fstn commented Jan 7, 2021

Hi,

I'm using this amazing engine in a project that need to apply rules based on date.

I'm doing rules like this:
"CurrentDate < 1610016640 and CurrentDate > 1110016640"

It works but the unix epoch representation is not as friendly as the iso8601 an I can't manage Timezone.
Any advice to use it with iso8601 date format?

@nikunjy
Copy link
Owner

nikunjy commented Feb 17, 2021

You have to extend this file
https://github.com/nikunjy/rules/blob/master/parser/JsonQuery.g4

add something on Line https://github.com/nikunjy/rules/blob/master/parser/JsonQuery.g4#L67
| DATE #date

then define what date is

DATE
   :  <define your date format here>
   ;

https://github.com/nikunjy/rules#how-to-extend-the-grammar

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