Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Peter

Smart filtering dates not working since 6.4

Hi Support,

Since updating to 6.4 (and every update since) smart filtering (or legacy filtering) our dates column doesn’t work as expected.
No matter what Smart filter I create for this column the results are not correct.
For example a simple ‘Date is before 30/03/2024’ brings back over 8000 posts with Date values ranging from 27/03/2024 up to 03/01/2027
Whereas ‘Date is after 30/03/2024’ brings back only 10 posts with Date values ranging from 27/04/2024 to 30/11/2024

For configuration:
The date column is an ACF Pro datepicker field, display format is set to d/m/y, and return format is set to Y-m-d.
The Admin Columns smart filter settings are set to ACF Date Format (d/m/y)
Checking the database I can see the date values are stored in the postmeta table as Y-m-d (2024-03-30)

I’ve tested different configuration of these formats to try and get the filtering to work, but setting the ACF field and Admin column filter to Ymd format doesn’t improve the results.

This issue only existed after the update to 6.4, we have multiple sites using the exact same data set and those that are on 6.3.5 are still working perfectly.

Any response would be greatly appreciated
Thanks!

5 months, 1 week ago
Stefan van den Dungen Gronovius
Developer

Thanks for your message.
It is good to know that the default format that ACF stores dates is ‘Ymd’.
When you want to add a column for an ACF date field, you’ll need to use the actual ACF column (prefixed with a green ACF icon in our column picker). The Custom Field column will not work here, because our filtering logic for that column only works when you’re using a timestamp or ISO date format, which is not the case for ACF.

– Are you using the ACF column for your ACF field?
– Are you sure that the stored date format for your custom field (in your database) is indeed ‘Ymd’?

Changing the display value to a different date format does not change the way that filtering works. That is just a display change.

Since version 6.4, our legacy filtering feature works with the same logic as Smart Filtering, where it has its own logic before. Our Smart Filtering feature is more flexible, but the data must be in a specific format to make it work.

5 months ago
Peter

Hi Support,

I’ve just double checked and can say yes, it’s definitely an ACF datepicker field with the green A, and inside the postmeta table the dates are stored in a LONGTEXT field and appear as 2024-02-19 with the dashes.

Hope that helps possibly identify the issue
Thanks

5 months ago
Stefan van den Dungen Gronovius
Developer

Just to be sure, did you use the ACF Date field, not the ACF Date Time field?
The for your Y-m-d is not the format that ACF uses to store dates.
Do you maybe enter the dates yourself with a migration script or external plugin using the update_field method in ACF? In your case, our ACF column won’t work because the date format is not as expected. Fortunately, we do support your date format, but you’ll need to change the column to the custom field column with field type set to ‘Date’. For the Stored date format you can use the ‘Y-m-d’ option.

5 months ago

You must be logged in to reply to this topic.