Searchbuilder Moment condition display format issue
Searchbuilder Moment condition display format issue
AlanKong
Posts: 5Questions: 2Answers: 0
The timepicker of Searchbuilder Moment condition displays something strange instead of human readable time. How to fix it?
Thx
This question has accepted answers - jump to:
Answers
This example seems to work correctly. Can you post a link to your page or a test case replicating the issue so we can help debug?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thanks for answering. The value in the input box doesn't seems correct. I was expecting "00:40", but it appears "40o403nt"
Understood. We will need to see the problem in order to help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
https://live.datatables.net/puzizavo/5/edit
Here is the testcase, see the "start date" column. Thank you
As shown in the example I linked to you need to use
$.fn.dataTable.moment( 'HH:mm' );
to define the datetime format being used. Also you need to includedatetime-moment.js
. I updated your test case to show this:https://live.datatables.net/puzizavo/8/edit
I also removed the
type: "moment
. It is not recommended to usecolumns.type
as Datatables performs data type detection. Without this and with$.fn.dataTable.moment( 'HH:mm' );
Datatables will correctly detect the data type asmoment
. The test case has a mix of different date formats in the same column causing type detection to return a string. I removed all the rows except the one you changed.Kevin
The other thing you will need to do is use Orthogonal data to display the
N/A
for empty dates. Otherwise theN/A
will be used for type detection, etc and the data type for the column will be string. Updated example:https://live.datatables.net/kasixehu/1/edit
Kevin
Wow, it works. Thank you!