Invalid Date when the date has milliseconds

Invalid Date when the date has milliseconds

KanthKanth Posts: 20Questions: 9Answers: 0

When entering a field in the editor that is a "datetime" data type, if there are milliseconds, I get "Invalid Date". (The date picker also blinks in and disappears, but may be unrelated.) The date properly formats when it displays with
"render": function (data, type, full) { return data == null ? "" : moment(data).format("M/D/YYYY h:mm A"); } }
in the editor I have:
{ label: "Order Date", name: "OrderDate", type: "datetime", def: function () { return new moment().format(); }, displayFormat: 'M/D/YYYY h:mm A', wireFormat: 'YYYY-MM-DDTHH:mm:ss' },
Does the editor get confused when the formatting is here if there are not milliseconds?.
If the data is "2020-11-27 11:06:24.000", it works. If it is "2020-11-27 11:06:24.2296518", it doesn't.

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    You probably need to change the wireFormat to match the format of your datetime string. See the Editor datatime options docs for more details. Look at the moment.js format docs docs. You might need something like `wireFormat: 'YYYY-MM-DDTHH:mm:ssSSSS' to define the milliseconds.

    Kevin

This discussion has been closed.