moment.js sorting 'MM/DD/YYYY h:mm:ss a' format not working
moment.js sorting 'MM/DD/YYYY h:mm:ss a' format not working
idris_bengali
Posts: 20Questions: 3Answers: 1
I created a milestone from an existing example and it is here http://live.datatables.net/juqapuzo/25/edit. have no issues with date only fields.
Thank you
Idris
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I commented out the moment plugin CDN and copied the code into the JS area. I added a couple of console.log commands and it highlights the issue. The problem is inconsistency with the format of your datetime string. In some cases you have to spaces between the date and the time and in others you have one. Looks like it depends on whether the hours is one digit or two.
http://live.datatables.net/yeraheva/1/edit
Note: I put two spaces in
$.fn.dataTable.moment('MM/DD/YYYY h:mm:ss a');
to match the first rows that have two spaces.My suggestion would be to fix this inconsistency in your server code. However you could try replacing the two spaces with one using
columns.render
.Kevin
Thank you KT... I fixed the program which does the HTML merge and it is working as expected.
Do I have the ability to close this post?
Idris
I've marked Kevin's reply as an accepted answer.
Allan