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
  • 0
    Certified Lead Developer

    I would suggest you try it without "toDate()" -- either try just "now()", or try "today()" to return a datetime value with just the date (i believe either of these should work for your filter though). 

    If that still doesn't seem to work right, you might want to check that the CDT used by the Data Store Entity you're querying from has the "fechaVencimiento" column declared as the correct data type (i.e. that it's date, and not text or something else incorrect).

Reply
  • 0
    Certified Lead Developer

    I would suggest you try it without "toDate()" -- either try just "now()", or try "today()" to return a datetime value with just the date (i believe either of these should work for your filter though). 

    If that still doesn't seem to work right, you might want to check that the CDT used by the Data Store Entity you're querying from has the "fechaVencimiento" column declared as the correct data type (i.e. that it's date, and not text or something else incorrect).

Children