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:
startDate 8th July 2022
endDate 10th July 2022
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
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?