1 year ago

Sorting by human readable date when using DataTables

Posted 1 year 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.


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.