-
Notifications
You must be signed in to change notification settings - Fork 552
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
Working with relative dates #334
Comments
Please use valid syntax for your code blocks,I edited your message with triple ` Your approach is the right one but the SQL generator was never designed for that. What do you think about a new filter method Something like (will change to accommodate complex operators) : getSQL: function(field, operator, value, rule) {
return field + operator + 'DATE_SUB(NOW(), INTERVAL ' + value + ' DAY)';
} Or this new method could only alter the value part. And is also needs a new |
Sounds great! But like something you have to implement? Or is this something i can do with the current version? in my case, the reverse operation, is not needed. But of course, it make sense to have it. My Idea was something like |
The big problem is that https://github.com/forward/sql-parser does not support this kind of "advanced" syntax, so the |
It is done, it requires the latest version of mistic100/sql-parser (1.1.0). There are not getters/setters but is totally based on events I added in a recent feature. jQuery-QueryBuilder/tests/plugins.sql-support.module.js Lines 194 to 270 in c72d367
|
Is it possible to work with relative dates? I Try to get a SQL output like
field > DATE_SUB(NOW(), INTERVAL 14 DAY)
my idea was...
but then the output is quoted like this
field > 'DATE_SUB(NOW(), INTERVAL 14 DAY)'
and if i use "type": "integer", the output is complete empty. It there any solutions to get this up?
Thanks
The text was updated successfully, but these errors were encountered: