Problems with date filter in a query

Hello,

 I have a problem with date filter in a query,

This is the code:


filters: {
a!queryFilter(
field: "fechaVencimiento",
operator:">",
value: toDate(now())

),

fechaVencimiento is date of BBDD.

The problem is that when I execute the query it is returning the last two records, while I should not return anything because those records have the current date but not greater.

Do you know any solution for this?

Regards, and thank you very much

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to sandrap845

    Hi Sandrap845,

     toDate(now()) - This value actually contains date with timestamp. You can check the timestamp by using the below expression: 

    datetext(todate(now()), "z")

    Can you try the below expression and see what is the date returned:

    date(year(now()), month(now()), day(now()))

    Then you can change your query filter as below and see how it works
    a!queryFilter(
    field: "fechaVencimiento",
    operator:">",
    value: date(year(now()), month(now()), day(now()))
    )

    Hope this helps

Children