Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ui-grid (3.0.0 unstable) cellFilter with dates issue

ui-grid (3.0.0-rc.16) doesn't work well when using filtering dates. Filtering on other fields works well.

Here comes a punker:

http://plnkr.co/edit/b9NSk0

Try to start entering 2014 for any date.

Bug or I missed something?

// main.js
var app = angular.module('myApp', ['ui.grid', 'ui.grid.i18n']);
app.controller('MyCtrl', function($scope) {
  $scope.myData = [{
    eventName: "event1",
    eventDateRaw: new Date(1416396274368),
    eventDateFormatted: new Date(1416396274368)
  }, {
    eventName: "event2",
    eventDateRaw: new Date(1416352423803),
    eventDateFormatted: new Date(1416396274368)
  }];

  $scope.gridOptions = {
    data: 'myData',
    columnDefs: [{
      name: 'eventName', width: "20%"
    }, {
      name: 'eventDateRaw', width: "40%"
    }, {
      name: 'eventDateFormatted', width: "40%",
      cellFilter: 'date: "yyyy-MM-dd HH:mm:ss.sss"'
    }],
    enableFiltering: true
  };
});

br remy44

like image 270
remy44 Avatar asked Nov 01 '22 14:11

remy44


1 Answers

Try and add a type:

{
    name: 'eventDateFormatted', width: "40%",
    cellFilter: 'date: "yyyy-MM-dd HH:mm:ss.sss"',
    type: 'date'
}
like image 176
Jason Avatar answered Dec 07 '22 02:12

Jason