date filter goes wrong with odatav4

I've an issue with setting a date filter in the grid.
The date filter on a datetime column is manually set in the grid to the date 2018-03-21

The odatav4-adaptor translates it to this:
$filter=(createdOn gt 2018-03-20T23:59:59.000Z) and (createdOn lt 2018-03-21T23:59:59.000Z)

I think the second condition should be: (createdOn lt 2018-03-22T00:00:00.000Z)
Otherwise records created on 2018-03-21T23:59:59.000Z will be missing in the result.

But, another problem is that when I load exactly the same filter at startup from code:

ngOnInit(): void {
  let filter =  { isComplex: true, field: 'createdOn', operator: 'equal', value: new Date(2018, 3, 21), condition: 'and', predicates: [{ isComplex: false, field: 'createdOn', operator: 'greaterthan', value: new Date(2018, 3, 20), ignoreCase: false, anyCondition: '' }, { isComplex: false, field: 'createdOn', operator: 'lessthan', value: new Date(2018, 3, 22), ignoreCase: false, anyCondition: '' }] };
  this.filtercolumns.push(filter);
}

Now the odatav4-adaptor translates it to this (which is different and wrong):

$filter=createdOn eq 2018-03-21T00:00:00.000Z

How to solve these two issue?


1 Reply

VN Vignesh Natarajan Syncfusion Team May 4, 2018 12:57 PM UTC

Hi Sietse, 
 
Thanks for using Syncfusion Products. 
 
 
Query: “I think the second condition should be: (createdOn lt 2018-03-22T00:00:00.000Z) && Otherwise records created on 2018-03-21T23:59:59.000Z will be missing in the result. 
 
We have analyzed your query and we have prepared a sample as per your suggestions. We are not able to reproduce the reported issue at our end. 
You have mentioned you are filtering the Grid with single value but while post is being sent you have two values. Are you changing filterSettings before the post is being sent.  
 
Refer the below screenshot how the post is sent for date column while perform the between operator filter. 
 
 
 
For your convenience we have prepared a sample which can be downloaded from below link 
 
 
Query: “that when I load exactly the same filter at startup from code 
 
We have analyzed your code snippet and we have found that you tried to use filterColumn method API but you have wrongly spelled the API. Refer the below code snippet 
 
ngAfterViewInit(){ 
      
    let filter =  [{ field: "ReleaseDate", operator: "equal",ignoreCase:true, value: new Date("10/1/2000"), predicate:"and"  }]; 
    this.Grid.widget.filterColumn(filter)     
    } 
 
 
 
Refer our help documentation  
 
Please get back to us if you have further queries. 
   
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon