Is DataTables v2.1.8 blocking luxon.js ?

Is DataTables v2.1.8 blocking luxon.js ?

sigurdnesigurdne 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

  • sigurdnesigurdne Posts: 8Questions: 2Answers: 0

    It seems to be the DateTime extension that is causing the problem.
    When omitting the DateTime extension from download - it works fine

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    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

  • sigurdnesigurdne Posts: 8Questions: 2Answers: 0

    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

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    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

  • Joshua44Joshua44 Posts: 3Questions: 0Answers: 0

    It's helpful to look at test cases. It seems to work well here. So layout differences may be key.

  • sigurdnesigurdne Posts: 8Questions: 2Answers: 0

    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;

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    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

  • sigurdnesigurdne Posts: 8Questions: 2Answers: 0

    An alternative fix was to use luxon.DateTime() instead of DateTime() in our code.
    We have updated our code, so there is no conflict anymore.

    Sigurd

Sign In or Register to comment.