Angular Kendo Grid Date column filter 'lte' work like 'lt'

1 Answer 68 Views
Grid
Maurizio
Top achievements
Rank 1
Iron
Maurizio asked on 09 Jan 2024, 01:44 PM

Hello,
I'm using the kendo-grid for angular and in a colum I have date format.

<kendo-grid-column
        field="toDate"
        title="A"
        [width]=160
        [format]=displayDateFormat
        filter="date"
        [style]="{ 'border': '1px solid #888' }"
        >
        <ng-template kendoGridFilterCellTemplate let-filter let-column="column">
          <kendo-grid-date-filter-cell
            [operator]="'lte'"
            [showOperators]="false"
            [column]="column"
            [filter]="filter"
            [formatPlaceholder]="{
              year: 'aaaa', month: 'MM', day: 'gg',
              hour: 'h', minute: 'm', second: 's', millisecond: ''
            }"
          ></kendo-grid-date-filter-cell>
        </ng-template>
            <ng-template kendoGridCellTemplate let-dataItem>
                {{dataItem.toDate | date: displayDateFormat}}
            </ng-template>
        </kendo-grid-column>

 

The only possible option for the filter is less than equal (<=) the problem is who the filter work like lt (<) and not consider equal value.

If i selecet the filter date 31/01/2024 (in italy whw use dd/MM/yyyy) the grid show only data to 30/01/2024.

The same configuration using 'gte' work fine.

Thanks

LSo

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Bechev
Telerik team
answered on 12 Jan 2024, 08:12 AM

Hi Maurizio,

Thank you for the provided code snippet.

Please keep in mind that whenever dates are filtered, their time is taken into consideration as well. When selecting a specific date from this filter and the filter operator is set to "is equal to" then there should be a data item that has a Date value (for its FirstOrderedOn column) corresponding to the exact same date and time selected from the filter. Otherwise, there will be no data that corresponds to the applied filter.

Currently, there isn't a built-in DateTime filter that can be used out of the box. However, it can be achieved by implementing a custom row filter or custom menu filter.

Please check the following example demonstrating that approach for a custom filter row using the DateTimePicker for the "First Ordered On" column:

https://stackblitz.com/edit/angular-whc7u6-ej2fyl

Alternatively, use a DateRange filter component and filter the dates by a specific range:

https://www.telerik.com/kendo-angular-ui/components/grid/filtering/filter-row/#toc-using-daterange

I hope this helps.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Grid
Asked by
Maurizio
Top achievements
Rank 1
Iron
Answers by
Martin Bechev
Telerik team
Share this question
or