I am having issues with the sorting for date columns. They are sorting as strings and when there is more than one date column in the table, the sorting is irregular.
The dates are saved to the DB as strings in mm/dd/yyyy format. Do I need to change the format they are saved in in order for the sorting to work correctly?
My advice would be to change the column type to "date" instead of "string". That way, sorting would be done by the actual date, and it doesn't matter if You were to change the format to display text or numbers (Jul or 07 for example). If I understood You correctly you have it set like 01/31/2000 and this way it should automatically sort it by date without any issues, so I don't know why sorting is messed up.
There can always be some conflicts if You set the columns which contain only numbers as "Strings", and maybe that is why the sorting is wrong.
Hi,
I am having issues with the sorting for date columns. They are sorting as strings and when there is more than one date column in the table, the sorting is irregular.
The dates are saved to the DB as strings in mm/dd/yyyy format. Do I need to change the format they are saved in in order for the sorting to work correctly?
Thank you!
Hello Jason.
My advice would be to change the column type to "date" instead of "string". That way, sorting would be done by the actual date, and it doesn't matter if You were to change the format to display text or numbers (Jul or 07 for example). If I understood You correctly you have it set like 01/31/2000 and this way it should automatically sort it by date without any issues, so I don't know why sorting is messed up.
There can always be some conflicts if You set the columns which contain only numbers as "Strings", and maybe that is why the sorting is wrong.
Can You provide some screenshots, please?
Best regards.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables