Updated on 17 Nov 2023.
This Pro tutorial shows how we can set post__in query parameter of a query loop in Bricks to an array of post IDs for which there is at least one date custom field (inside an ACF Repeater) value that is today or in the future.
Update: We also provide the code for the case where all the dates should be today or in the future.
Consider the following scenario:
Post type: group-program (json export for import in ACF Pro)
Field group (json export):

Note that the Return Format for the date-type sub field has been set to Ymd.
Sample CPT entry with the custom field populated:

Sample entries in our test site as on 19 Oct 2023:
Program 1:
20/10/2023 (future – dd/mm/yyyy format)
Program 2:
02/10/2023 (past)
Program 3:
26/10/2023, 31/10/2023 (both future)
Program 4:
(empty)
Output after implementing the tutorial:

If an entry has multiple dates, we are going to code the logic such that only current (today) or upcoming dates are output.
For example, if we change Program 3’s dates to be 12 Nov 2021 and 31 Oct 2023 then the output would be:

Step 1
Let’s create a custom function that loops through all the posts of our post type, gets the value of the ACF Repeater field, checks the dates of the date-type sub field for each row and if at least one date value is equal to or greater than today, add that post to the post IDs array.
Add the following in child theme‘s functions.php or a code snippets plugin:
// Function that returns an array of post IDs per the following.
// Loop through all posts
// For each post, get the value of the ACF Repeater field "program_dates"
// Check the dates of the "program_date" sub field for each row
// If at least one date value is equal to or greater than today, add that post to the IDs array.
if ( ! function_exists( 'bl_get_post_ids' ) ) {
function bl_get_post_ids():array {
// WP_Query arguments
$args = [
'post_type' => [ 'group-program' ],
'posts_per_page' => -1,
];
// the array to hold the post IDs, empty to begin with
$post_ids = [];
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
// get the value of the ACF Repeater field "program_dates"
$program_dates = get_field( 'program_dates' );
// loop through program dates and check if any are equal to or greater than today
// check rows exist
if ( have_rows( 'program_dates' ) ):
// loop through rows
while( have_rows( 'program_dates' ) ) : the_row();
// Load sub field value
$date = get_sub_field( 'program_date' );
// if the date value is equal to or greater than today, then add that post to the IDs array
if ( $date >= date( 'Ymd' ) ) {
$post_ids[] = get_the_ID();
// break out of the while loop
break;
}
// end loop.
endwhile;
// no value.
else :
// Do something...
endif;
}
} else {
// no posts found
}
// restore original Post Data
wp_reset_postdata();
return $post_ids;
}
}
Update: Here’s the code if you want all the date sub field values to be either today or in the future.
Step 2
In the Bricks editor, copy this JSON and paste it.

For the Post Loop Block we are setting the query to:
