#[CLOSED] Query.between

1 messages · Page 1 of 1 (latest)

chilly surge
#

Cant between filter collection with a dateTime attribute?

const query = [Query.between("dateTimeAttribute", "ISOString", "ISOString")]

Currently I'm getting the error Query not valid: Query type does not match expected: datetime.
I'm confusing if the errors refers to isn't possible to query datetime attributes, or the value sen't isn't right

topaz oasis
#

I've just tests it
Can you share the full ISOString you've send?

#

I've send something like this

const query = [
  Query.between('date','2022-08-17T00:03:13.182Z','2024-08-17T00:03:13.182Z');
]

And it gave me indeed anything in between

chilly surge
topaz oasis
#

It should work
It's interesting that the query put the values into arrays
Can you try this

const query = [
  ...
  `between("data", "2023-08-15T04:00:13.989Z","2023-08-15T07:00:21.100Z")`,
]

This way we try to force it to use 3 parameters one

chilly surge
#

I'll create an issue

topaz oasis
#

I think it has to do with all other SDKs

#

I saw it in other

chilly surge
#

You mean in others sdk it's working?

topaz oasis
#

No,
They have the bug as well

chilly surge
#

Oh, yes I saw it in the sdk generator repo and it's the same for all

topaz oasis
#

Exactly

chilly surge
#

The problem seems to be here

static addQuery = (attribute, method, value) =>
    value instanceof Array
      ? `${method}("${attribute}", [${value
          .map((v) => Query.parseValues(v))
          .join(",")}])`
      : `${method}("${attribute}", [${Query.parseValues(value)}])`;

It always parse the values as string array

topaz oasis
chilly surge
#

I think isn't possible to make a change in the SDK repo, as there are cases like when you send multiples values in an array, so in theory the query is valid. The problem is the between method