Skip to content

Allow date data types? #13

@ghost

Description

I need your library for parsing expressions but I saw that it only supports numbers and strings.
Is it possible to somehow allow date manipulation?
The expression I need to parse is:

'31.07.' + (myDate.getMonth() <= 7 ? myDate.getFullYear() + 3: myDate.getFullYear() + 4 )

Activity

cshaa

cshaa commented on May 2, 2018

@cshaa
Contributor

You can define your custom functions for it:

let filter = compileExpression(
  '"31.07." + (month(myDate) <= 7 ? year(myDate) + 3 : year(myDate) + 4)',
  {
    month: date => date.getMonth(),
    year: date => date.getFullYear()
  }
);

filter({myDate: new Date()});
cshaa

cshaa commented on Feb 24, 2019

@cshaa
Contributor

@joewalnes Close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cshaa

        Issue actions

          Allow date data types? · Issue #13 · joewalnes/filtrex