Formatting date text outside of columns in expandable accordion (details)
Formatting date text outside of columns in expandable accordion (details)
peter-werk
Posts: 8Questions: 4Answers: 0
Hello, I have a problem formatting the date in the expandable details that is not defined in the column defection as this is formed before table.
Here is the code
$(document).ready(function() {
var clipboard = new ClipboardJS('.btn');
function format(d) {
return '<div class="row"> 'Last Updated: ' + {data: d.UpdatedAt, render: $.fn.dataTable.render.moment("YYYY-MM-DDTHH:mm:ss.SSSZ",'Do MMM YY' )} + '<br>' +
'</div>';
}
Date format in the table is UpdatedAt: "2022-09-17T10:00:32.595Z"
And I'm getting - Last Updated: [object Object]
Edited by Kevin: 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
This won't work:
Basically you are trying to display an object. Just use moment to display the date. See if this works:
The syntax might not be correct but it should get you going in the right direction.
Kevin