Sort date DD/MM/YYYY hh:mm

Sort date DD/MM/YYYY hh:mm

PandalexPandalex Posts: 34Questions: 9Answers: 1

Link to test case:
https://live.datatables.net/xuruheto/1/edit?html,js,output

Hi, I'm trying to sort my table using the Datatable datetime but it doesn't work at all for a date like "31/03/2025 10:25".
I reproduced it in the test case above, what am I missing ?

Thanks,

Alexis

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,223Questions: 1Answers: 10,598 Site admin
    Answer ✓

    Hi Alexis,

    If you run your example it gives the alert:

    DataTables warning: Formatted date without Moment.js or Luxon - https://datatables.net/tn/17

    Going to the url given notes that if you use anything other than ISO8601 formatting you need to use Moment or Luxon.

    Your example was also failing because 31/04/2011 01:09 is not a valid date. April only has 30 days.

    Fixing both issues addresses the problem: https://live.datatables.net/xuruheto/2/edit .

    Allan

  • PandalexPandalex Posts: 34Questions: 9Answers: 1

    Perfect, thank you !

    I also wanted to sort 2 dates format, and saw that I can just add another line DataTable.datetime('XXX');

Sign In or Register to comment.