I figured it out afterwards.
Ended up using a different approach, I’m posting it in case someone has the same issue
<?php
date_default_timezone_set('America/Argentina/Buenos_Aires');
$posts_by_date_field = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => -1,
'meta_key' => 'fecha',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_type' => 'DATE'
));
if ($posts_by_date_field->have_posts()) : while ($posts_by_date_field->have_posts()) : $posts_by_date_field->the_post();
// LOOP
$today = date("Y-m-d");
$date = CFS()->get('fecha');
if ($date >= $today) :
$date = new DateTime($date);
$year = $date->format('Y');
$month = $date->format('F');
if ($aux_year != $year) {
?>
<div class="anio"> <?php echo $year; ?> </div>
<?php
}
if ($aux_month != $month) {
?>
<div class="mes"> <?php echo $mes ?> </div>
<?php
}
?>
<div class="metaData">
<p> <?php the_title(); ?></p>
<p> <?php echo CFS()->get('fecha'); ?> </p>
<p> <?php echo CFS()->get('hora'); ?> </p>
<p> <?php echo CFS()->get('lugar'); ?> </p>
</div>
<?php
$aux_year = $year;
$aux_month = $month;
endif;
endwhile;
endif;
?>