Skip to content

Working with relative dates #334

@netonme

Description

@netonme

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...

var filter = {
    "id": "field", 
    "field": "field", 
    "type": "string", 
    "operators":[ "equal", "not_equal", "less_or_equal", "greater_or_equal", "between"], 
    "data": {
        "mode": "rel"
        },
    "valueGetter": function (rule) {
        return 'DATE_SUB(NOW(), INTERVAL ' + rule.$el.find('.rule-value-container input').val() + ' DAY)';
        }
    }

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions