I have some dates for my tickets for the event like the following screenshot and I am using ACF repeater for this.
And I have a function where I am trying to compare the ticket registration start date with the current date.
function santy_shortcode_race_categories_event_post(){
date_default_timezone_set('Asia/Kolkata');
$result = '<div class="table-responsive">
<table class="table table-bordered" style="text-align:center; background-color:#fff;">
<thead>
<tr class="table-head">
<th>Package</th>
<th>Age Category</th>
<th>Ticket Price</th>
<th>Reg. Link</th>
</tr>
</thead>
<tbody>';
$id = get_the_ID();
$current_date = date("Y-m-d H:i:s");
if( get_field('Race-Categories', $id) ) {
while( the_repeater_field('Race-Categories', $id) ) {
$event_start_date .= date("Y-m-d H:i:s", strtotime("+5 hours +30 minutes", strtotime(get_sub_field("ticket_registration_start"))));
$event_end_date .= date("Y-m-d H:i:s", strtotime("+5 hours +30 minutes", strtotime(get_sub_field("ticket_registration_end_date"))));
$result .='<tr>';
$result .='<td>'.get_sub_field("package").'</td>';
$result .='<td>'.get_sub_field("age_category").'</td>';
$result .='<td>'.get_sub_field("ticket_price").'</td>';
if($current_date > $event_start_date){
$result .= '<td>Registration Open</td>';
}else{
$result .= '<td>Registration Close</td>';
}
$result .='</tr>';
}
}else{
$result .='No Any Race categories allocated for this event. Try other events.';
}
$result .= '</tbody>
</table>
</div>';
return $result;
}
But this is returning wrong output, going share below the screenshot of my output..
It is showing in every row registration open but logically it should be show registration closed and show only registration open for 2 km Family-Run.

