Unable to specify separate predicates match within the same group item

Hi,

I'm currently attempting to build an event calendar for events which can have one or more performances, each with their own start and end dates.

I have created a custom type Event has a group field called 'Event Dates', where each item within the group has a startDate and an endDate, in order to specific multiple date ranges for when an event in on.

I'm trying to query the API to ask for events which are taking place on a certain date, using the following logic:

          predicates.push(
            $prismic.predicates.date.before(
              'my.event.eventDates.startDate',
              '2022-07-14T00:00:00+01:00',
            ),
          )
          predicates.push(
            $prismic.predicates.date.after(
              'my.event.eventDates.endDate',
              '2022-07-12T23:59:59+01:00',
            ),
          )

In the case when I have an event with two Event Date group items:

Item 1:
startDate 8th July 2022
endDate 10th July 2022

Item 2:
startDate 16th July 2022
endDate 19th July 2022

If I search for which events are active on the 13th July, it matches on the startDate of 'Item 1' being before the 13th July, and the endDate of 'Item 2' being after the 13th July - therefore the query returns the event as being on on the 13th July, which is incorrect.

I require the two predicates to match only on startDate and endDate if they are in the same group item, as each represents a specific date range.

Is this possible? And if not, is there another way to achieve what I want?

Hi @studiotreble

Thanks for reaching out.

I'm trying to reproduce the issue on my side; usually, your query should not match the Item 1.

Can you please share with me your repository name (in a private message if necessary ) as well as a link to the query in the API browser if you possible (it makes it easier to investigate there) to learn more about how to use the API browser please check this link?

Looking forward to your reply,
Fares

Hi Fares, I've private messaged you with the repo details.

1 Like

Thanks, @studiotreble
I have recieved the private message I will investigate and let you know soon

1 Like