Sorting by human readable date when using DataTables

Posted 11 months ago by nickdavies07

Not entirely a Laravel question but have asked this question on DT forum as well. Just thought someone may know!

Is there a way to sort a column by a human readable date?

I use the Carbon date package with the diffForHumans() method to convert my dates to human readable format i.e. 3 days ago, 5 minutes ago etc.

Datatables seems to sort numerically and alphabetically.

Example: https://screenshots.firefox.com/IYm9uC74bz0HaKq8/asset-manager.ngrok.io

Using Laravel's sortBy() and SortByDesc() doesn't seem to affect the column.

Please sign in or create an account to participate in this conversation.