Hello, i try to sort my list view by date with this shortcode:
[EVENT_LIST category_identifier=catnamexyz show_expired=true order_by=start_date sort=DESC]
The DES or ASC attribut has actullay an influence but the dates are totaly mixed up… How can i solve this?
Hi, i found out that due to a modification to the date picker to european format (dd-mm-yyyy) the dates became mixed up. I revertred that for now, but i am sure its possible to fix it in a different way. Is thete a special reason why the mysql field type of the date field is not set to format “date” in the db ?
The reason is legacy code. For us to go in and change it now would cause a lot of breakage for our customers that have EE running production sites. We recognised the problem of legacy code over a year ago and began work on EE 4.0, which is totally rewritten from the ground up (uses unix timestamps instead of dates in the db).
One solution would be to modify insert_event.php and update_event.php to take the modified date format the date picker is producing and change it to the Y-m-d format before storing it in the DB, so that it is again sortable as a string. That would be my preference, since there may be places in the rest of the code that depends on the date being stored in the db in that format.
Another solution would be to do a custom array sorting on the results of the db query, ie. convert the custom time format stored in the db into a unix timestamp and use that as the key to build a new array of the events. That way when the new array of events is iterated over, it will be in order.
The support post ‘sorting by categorie and date’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.