Closed Rejinderi closed 8 years ago
Hi! I guess you have found the solution by yourself, may I ask if you could share it, for future reference?
For my part, I would have suggested using Moment.js to format that field.
FWIW, I used moment.js as follows:
function renderDate(data, type, row) {
if (data) {
var dm = moment({y: data.year, M: data.monthValue - 1, d: data.dayOfMonth});
switch (type) {
case 'display':
return dm.format("D MMM YY");
default:
return dm.format("X");
}
}
else {
return '';
}
}
Then apply to your column using the render
keyword
{
'data': "txnDate",
'render': renderDate
},
The same technique can be applied to LocalTime and LocalDateTime too.
@dawnofclarity great, thanks! :+1:
Local datetime objects are rendered as [Object object] any ways to have them rendered properly?