Skip Navigation

[Resolved] Sort by custom date field is not working

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1476045

I am trying to: sort a view by a custom date field

Link to a page where the issue can be seen: hidden link

I expected to see: the date to be sorted by date

Instead, I got: the data sorted (i think) alphabetically.

Here's my view: hidden link

#1476739

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Amin,

Thank you for contacting us and I'd be happy to assist.

I've tested a date field in a similar view with a sortable table layout on my website, but couldn't reproduce this issue.

To troubleshoot it, I'll suggest the following steps:

1. Please make sure that WordPress, active theme and plugins are all updated to the latest versions.

2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty.

If it's fixed, you can start adding the disabled items, one-by-one, to narrow down to a possible conflicting one.

3. In case the issue still persists, I'll need to see exactly how this view and the date field's data is set up, to be able to reproduce it on a test website.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1477009

I think I may have figured out the problem.

In my spreadsheet, the date was entered as 1/2/2020 12:00am. I changed it to Unix Timestamp and am re-importing the data.

Is there an ideal date format when importing in bulk into a custom post type with custom date field?

#1480227

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and that explains it.

By default, Toolset's "date" type custom field stores the date in Unix Timestamp.

For this reason, it is important that if you're importing data in this field, that data is also added in this same format, so that Toolset's date related operations (like filters, sorting etc), can be used with those custom field values too.
( ref: https://toolset.com/documentation/user-guides/views/date-filters/ )

I hope this helps.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.