Why datetime not showing properly in Editor datatables.

Why datetime not showing properly in Editor datatables.

OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0
edited August 2022 in Free community support

these are the fields I am using in editor.

Also I have added dataTables.dateTime.min.css,dataTables.dateTime.min.js files.

 fields: [ {
                label: "ID :",
                name: "holidayid",
                type:"hidden",
                data :"holidayid"
                
            }, {
                label: "Name :",
                name: "description",
                data :"description",
            }, {
                label: "Holiday Date :",
                name: "holidaydate",
                type:"datetime",
                data :"holidaydate"
            },
            {
                label: "Status :",
                name: "status",
                data : status,
                type: "select",
            }
        ]

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

Answers

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    And when click on Holiday Date Input field its always showing today date.
    Not what date we have given.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    That looks like a Unix timestamp to me. How are you reading it from the database? Given that it isn't ISO8601 you'll need to use displayFormat and wireFormat as shown in this example. The Moment.js formatting tokens are detailed in their docs.

    Allan

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    Understood
    But from server I am getting the holidaydate as Milliseconds.
    How to give that format in wireFormat?

    Currently I am giving as mentioned below but that is not correct bcoz I am getting milliseconds from back end. Please tell how to give that.

    {
    label: "Holiday Date :",
    name: "holidaydate",
    type:"datetime",
    displayFormat: 'YYYY-MM-DD',
    wireFormat: 'YYYY-MM-DD'
    }

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    Please reply I am waiting for your response.

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    This is format I am getting holidaydate from Backend
    Format : 2022-05-17 00:00:00.0

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    And I have added like below still facing same problem.
    {
    label: "Holiday Date :",
    name: "holidaydate",
    type:"datetime",
    displayFormat: 'YYYY-MM-DD',
    wireFormat: 'YYYY-MM-DD HH:mm:ss.S',
    },

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    Please reply I am waiting for your response.

    If you could wait at least 24 hours before bumping a post, that would be appreciated.

    Could you show me a sample of the JSON that is being loaded from the server please? Initially you said it was epoch milliseconds, and now you've said it is ISO8601 - I'm not sure which it is?

    Also, do you have Moment.js loaded on the page? If you could link to the page showing that issue, that would be really useful.

    Allan

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    Sorry,

    This is the JSON from backend

    And Monent.min.js is loaded.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    Thank you. So the wire format (what is received and what is sent) is Unix epoch time in milliseconds. From the Moment.js documentation, your wire format should therefore be x.

    Allan

  • OmniwyseOmniwyse Posts: 29Questions: 11Answers: 0

    Thanks,

    You mean to say like below,

            {
                label: "Holiday Date :",
                name: "holidaydate",
        type:"datetime",
        displayFormat: "YYYY-MM-DD",
        wireFormat: "x",
            }
    

    If yes, I have tried like this , but its not working . Same problem as earlier I could see.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    I would expect that to work. As it isn't could you link to a page showing the issue so I can debug and trace it thought please.

    Thanks,
    Allan

Sign In or Register to comment.