Search results for ""

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

Custom Date Field Sorting Issue

We’re having an issue with a Woocommerce Product custom date field on version 5.2 onwards of Admin Columns Pro.

The field data is stored in dd-mm-yyyy format.

The latest versions of Admin Columns Pro will display the date field correctly but the sorting and filtering functionality won’t process the dates properly (the filtering dropdown isn’t processing the dd-mm-yyyy format – it is displaying like TuesTuesMarMar etc. which seems to be the root of the issue).

3 years, 10 months ago
Stefan van den Dungen Gronovius

Since version 5.2 we improved sorting quite a lot. The speed of sorting for some columns (mainly custom field columns) was sometimes even 10 times faster. We do now sort directly on the database instead of doing natural sorting in PHP. Unfortunately, this means that for date columns, sorting does not work anymore when the date format cannot (easily) sorted or filtered in MySQL. The ‘dd-mm-yyyy’ is a date format that is not supported anymore. The reason that we removed sorting for some columns, is because the old logic only worked for small datasets and often gave timeout issues on large datasets.

My advice is to use a Unix Timestamp or a MySQL date format when storing date fields in custom fields and format the value for use on your front-end. Unfortunately, there is currently no way to make sorting and filtering work for your date format.

3 years, 9 months ago

Thanks for the update and offering some clarity, Stefan.

3 years, 9 months ago

You must be logged in to reply to this topic.