Prismic query predicates misinterpreting timestamp field type

98 Views Asked by At

I am trying to query my data using my custom field of type Timestamp (created using Slicemachine). I can see that field is also defined as type Timestamp in index.json under /customtypes/mycustomtype/.

      "end_date": {
        "type": "Timestamp",
        "config": {
          "label": "End date",
          "placeholder": ""
        }
      }

However when I try to create a query with dateAfter predicate I am getting an error.

Query:

 const events = await client.getAllByType('event', {
        predicates : [
            prismic.predicate.dateAfter("document.data.end_date", new Date()) 
        ]
}

error message:

error - ParsingError: [function date.after(..)] 'Date' or 'Timestamp' field expected on line:1 col:14 in query '[[date.after(document.data.end_date, 1677426405339)]]'
[[date.after(document.data.end_date, 1677426405339)]]
             ^

Out of curiousity I tried to rewrite the same query and use the Prismic document built in field document.last_publication_date - this time, the query predicate worked as expected.

Any idea why the custom type field data types are not being interpreted correctly? Any help is appreciated.

0

There are 0 best solutions below