console
var columnDefs = [{
headerName: "Date",
field: "datecustom",
width: 150,
filter: 'date',
filterParams: {
comparator: function(filterLocalDateAtMidnight, cellValue) {
var dateAsString = moment(cellValue).format('DD/MM/YYYY');
var dateParts = dateAsString.split("/");
var cellDate = new Date(Number(dateParts[2]), Number(dateParts[1]) - 1, Number(dateParts[0]));
if (filterLocalDateAtMidnight.getTime() == cellDate.getTime()) {
return 0
}
if (cellDate < filterLocalDateAtMidnight) {
return -1;
}
if (cellDate > filterLocalDateAtMidnight) {
return 1;
}
}
}
}];
var rowData = [
{datecustom: '2017-10-03 12:18:55'},
{datecustom: '2017-10-01 16:53:04'},
{datecustom: '2017-09-27 13:39:47'},
{datecustom: '2016-01-26 13:39:47'},
{datecustom: '2016-03-23 13:39:47'},
{datecustom: '2015-02-26 08:24:48'},
{datecustom: '2015-08-21 08:24:48'}
];
var gridOptions = {
defaultColDef:{filter:true,resizable:true},
columnDefs: columnDefs,
rowData: rowData,
enableFilter: true,
enableColResize: true
};
document.addEventListener('DOMContentLoaded', function() {
var gridDiv = document.querySelector('#myGrid');
new agGrid.Grid(gridDiv, gridOptions);
});
<script src="https://unpkg.com/@ag-grid-enterprise/all-modules@22.1.2/dist/ag-grid-enterprise.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>
<div style="height: 100%; box-sizing: border-box;">
<div id="myGrid" style="height: 100%;" class="ag-theme-balham"></div>
</div>
html, body { margin: 0; padding: 0; height: 100%; }