Is DataTables v2.1.8 blocking luxon.js ?
Is DataTables v2.1.8 blocking luxon.js ?
sigurdne
Posts: 8Questions: 2Answers: 0
I have the luxon.js for dealing with dates and times in my application.
I upgraded DataTables from 1.13.8 to 2.1.8 - and now the DateTime.fromJSDate() is not a recognised as a function.
If do not load the datatables.js - it works fine
I noticed there are some references to luxon within the datatables.js - is it blocking the original?
Regards
Answers
It seems to be the DateTime extension that is causing the problem.
When omitting the DateTime extension from download - it works fine
Can you link to a test case showing the issue please? It appears to work okay here so there might be something in the configuration you are using.
Allan
Yes, probably somthing local - was'nt able to reproduce it in the live-test, even when including "everything".
https://live.datatables.net/fofusupu/1/watch?html,js,output
When you say "blocking", what do you mean? An http request, or the UI won't click and focus or something else?
Perhaps try a ctrl-f5 refresh?
Allan
Found out:
if the DateTime extension loadet
<script src="https://cdn.datatables.net/datetime/1.5.4/js/dataTables.dateTime.js">
</script>
Then the luxon DateTime-function has to registered as follows:
globalThis['DateTime'] = luxon.DateTime;
I wouldn't expect that to be required and it isn't in any of the examples that use that file. If you are able to reproduce the error in an example that I can take a look at, that would be really useful.
Many thanks,
Allan
An alternative fix was to use
luxon.DateTime()
instead ofDateTime()
in our code.We have updated our code, so there is no conflict anymore.
Sigurd