I know this question has been asked many times before but still cannot get a firm answer.
I am getting data from a Mongo database which only stores dates as datetime – e.g. ISODate(“2019-03-15T00:00:00.000Z”)
For my cellrender I define:
{
text: "My Date",
dataField: "myDate",
cellsrenderer: dateRenderer,
cellsformat: 'MM/dd/yyyy',
cellsalign: "center",
width: 130
},
Cellrender function takes data and converts to moment utc:
function dateRenderer(row, columnfield, value)
{
var myDate = value ? moment.utc(value).format(‘MM/DD/YYYY’) : “”;
var cssclass = “jqCell jqx-grid-cell-middle-align ”
return ‘<div class=”‘ + cssclass + ‘”>’ + myDate + ‘</div>’;
}
The cell column renders fine. However when I GROUP on the column the date is one-day off – i.e. not honoring the date in the cell.
So the cell would correctly 03/15/2019 but the GROUPING label shows 03/14/2019.
I am unsure how to make this consistent.
Can you please provide guidance on this?
Thanks.
Rob