Problem with format in 'searchDateTime' columnControl
Problem with format in 'searchDateTime' columnControl
Wernfried
Posts: 31Questions: 8Answers: 0
I use columnControl with searchDateTime content
columnControl: [
'order',
[
{ extend: 'searchDateTime', format: 'YYYYMMDD', excludeLogic: ['notEmpty', 'empty', 'notEqual'] },
]
]
DataTables throws an error:
Uncaught DateTime: Without momentjs, dayjs or luxon only the format 'YYYY-MM-DD' can be used
I use luxon in my page, function DateTime is available. Apart from that, format YYYYMMDD is valid according to ISO-8603, see https://en.wikipedia.org/wiki/ISO_8601 - it is called "basic format". DateTime.fromISO() accepts both formats (as momentjs, dayjs do also).
For me, it's a minor issue, no rush to fix it.
Kind Regards
Answers
I get the same error also when I try to import
I cannot use
import DateTime from 'datatables.net-datetime';as proposed in https://datatables.net/extensions/datetime/ because then I get a conflict:When using ES modules try:
That will register both luxon (
import * from 'luxon';) and DateTime with DataTables, since those packages aren't in a global scope and they don't have explicit dependencies.Interesting point about the YYYYMMDD format. I'll probably need to make a bunch of changes over the libraries to support that.
Allan