Trouble when publishing the page

Trouble when publishing the page

alimanovicalimanovic Posts: 3Questions: 1Answers: 0
edited September 2023 in Free community support

Hi

Everything works fine when testing the page in Visual Studio 2022 locally and when deployed on local IIS running on Windws Server 2016 again locally.
Trouble starts when deploying the same script on webserver by Simply.com.

The date is not formatting as it is supposed. Se image.
Currently using columnDefs to define the dateformat.

$('#sales').dataTable({
    columnDefs: [
        {
            type: "name",
            targets: [11]
        },
        {
            targets: 1,
            render: DataTable.render.date()
        },
        {
            targets: 2,
            render: DataTable.render.date()
        },
        {
            targets: 3,
            render: DataTable.render.date()
        },
        {
            targets: 4,
            render: DataTable.render.date()
        },
        {
            targets: 6,
            render: DataTable.render.number(null, null, 2, '')
        } ,
        {
            targets: 7,
            render: DataTable.render.number(null, null, 2, '')
        },
    ],
});

Any ideas?

Thanks!

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    If you could give me a link to the page showing the issue I'd be able to say why it is rendering that way (since I'll be able to debug a running page - its a bit tricker with an image ;)).

    Allan

  • alimanovicalimanovic Posts: 3Questions: 1Answers: 0

    Here comes the link to the page hosted by Simpley.com.

    http://mybusinessystem.com/Pages/en-EN/Clients

    Thanks in advance!!!

  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975
    edited September 2023 Answer ✓

    One issue is you are loading moment.js twice; once on line 2367 and the other on line 2658. I should only load this once. However that is not the issue.

    Looks like the one on line 2658 is version 2.18.10 while the other is version 2.29.2.

    I copied the relevant code into this test case:
    https://live.datatables.net/kaluxidu/1/edit

    It shows Invalid dates for the dates above that show the timestamp. You need to provide the format of the date using the moment.js format docs. Here is the updated example using the 2.29.8 moment.js version with the change for Order Date column:
    https://live.datatables.net/sawikeni/1/edit

    See this example for more details.

    I would recommend removing the old moment.js version on line 2658.

    Kevin

  • alimanovicalimanovic Posts: 3Questions: 1Answers: 0

    You guys are awesome!!!

    Thank you!!!

Sign In or Register to comment.