johnbillion/extended-cpts

ACF date field not formatting correctly in admin column

paulburgess opened this issue · 8 comments

Hi, I have an ACF date field being displayed in an admin column like so:

'event_start_date' => array( 'title' => 'Start date', 'meta_key' => 'event_start_date', 'date_format' => 'd/m/Y' ),

That code formats the date like so:

Screenshot-l2Q126KD@2x

If I remove the formatting, it displays the correct date, just in the more raw format:

Screenshot-sRgspGTX@2x

Oddly this same code and formatting works fine on another project which is using an older version of extended CPTs

Any idea what is going on here?

Many thanks!

What format is the event_start_date field stored in?

Hi, the format in the screenshot: YYYYMMDD

Oddly, it works fine in another project, and if I copy that older extended-cpts folder over to this one with the issue, it all works fine.

Where can I find the version number in the readme or license?

The version is in the extended-cpts.php file in the @version tag

#187 was a recent change to this handling

Thanks John, the version I was using 4.4.1 - where it works fine. I'm sorry, what do I need to alter to get the date formatting working again? I'm not sure what I'm looking for here: #187

I have resolved this by moving away from ACF's date format of just YYYYMMDD, to use a Date / Time picker which saves the date in a timestamp format and works correctly with the latest Extended CPT date formatting.

It seems ACF use this format so they can support old versions of WP.

There are also ways of saving ACF date fields in the timestamp format via filters, but the date / time picker was my fix for this.

Thanks John!

Thanks for the update Paul. It's difficult to handle every possible date format, and seeing as a timestamp is a more portable format I think you made the best decision.