Support

Account

Home Forums Add-ons Repeater Field Compare dates in rows against today Reply To: Compare dates in rows against today

  • Hi @phatoz

    If I get it right, you should provide the current date. Also, I’m sorry I forgot to remove the number “85”. It’s just a post ID for testing purpose. So, your code should be like this:

    <?php
    
    // date starting the week of loaded treasure bag
    $today = date('Ymd');
    $last_week = $today-6;
    $next_week = $today+6;
    
    $treasure_bag_date = get_sub_field('treasure_bag_date');
    ?>
    
    <tr <?php if( ($treasure_bag_date >= $last_week) && ($treasure_bag_date <= $next_week) ){ echo "id='active_week'"; }?>>

    I hope this helps 🙂