Support

Account

Home Forums General Issues Passing all ACF form data to a React table Reply To: Passing all ACF form data to a React table

  • If a value has not been set then ACF will return NULL for the value and I don’t know what effect passing null to new DateTime() has. I’ve personally never used this class for dates, but that NULL value is probably what’s causing the wrong date value.

    something like this would do the same thing and I would not consider it hack. It’s the way that ACF works.

    
    $formatted_date = '';
    if (get_field('date_completed', $post_id) {
      $date = get_field('date_completed', $post_id);
      $date_completed = new DateTime($date);
      $formatted_date = $date_completed->format('M j Y');
    }