Editor - Date formatting weirdness
Editor - Date formatting weirdness
dpanscik
Posts: 202Questions: 47Answers: 0
I am using date formatting ddd, DD MMM YYYY
I love it. I feel its the most international / world friendly date format.
It looks like this in datatable
However when I click on inline editing it looks like this
And editor popup it looks like this
I think? I am properly instructing editor what date format to use...
editor = new $.fn.dataTable.Editor({
ajax: '/api/APData',
table: "#ApForm",
"data": function (d) {
return $.extend({}, d, {
"form_id": "APgrid",
});
},
formOptions: {
inline: {
submit: 'allIfChanged',
},
},
fields: [
{
label: "EmailReceivedDate",
name: "EmailReceivedDate",
type: "datetime",
format: "ddd, DD MMM YYYY"
},
{
label: "InvoiceDate",
name: "InvoiceDate",
type: "datetime",
format: "ddd, DD MMM YYYY",
},
]
});
Answers
Looks like you need to use
wireFormat
anddisplayFormat
since your wire data is ISO8601. See this example.Allan
wireFormat: "YYYY-MM-DD"
did not work for me. I think there is more to it... a missing javascript include perhaps.what did work is changing in Model the date field from date to string
Odd... I would expect the opposite. I would expect a date field labeled as a string to cause formatting weirdness. However in my situation a date field labeled as a date field causes weirdness.
Looks like your wire format is actually:
Allan