This is a migrated thread and some comments may be shown as answers.

Vue Grid (Native) filtering not working for dates

7 Answers 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhanushka
Top achievements
Rank 1
Dhanushka asked on 08 Aug 2019, 03:33 AM

Hi,

Trying to implement grid (native) filtering. It has a date time column. Filtering seems to not work for this column.

https://stackblitz.com/edit/gqlmpp

7 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 09 Aug 2019, 04:49 PM
Hi Dhanushka,

The values of the "date" field in the data should be actual Date objects, for example:
"date": new Date(2019, 7, 15)
instead of string:
"date": "2018-08-15T00:00:00"

This will make date filtering possible. For example see this screenshot, in which we filter for dates after August 13 2019, and only the first record matches this condition. 

Regards,
Ivan Danchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dhanushka
Top achievements
Rank 1
answered on 08 Nov 2019, 03:05 AM

Thanks Ivan for the clarification.

We still face an issue when trying to filter a date column with "eq" operator. Although there are dates with new (2019, 10, 8) it doesn't seem to filter any of them. After debugging, noticed that the time portion is 11:00:00 instead of 00:00:00 for the date entered in the filter input. See attachment. So probably, date comparison fails because of the time difference.

I can get it to work if I force the date object to be new Date(2019, 10, 8, 11).

 

 

 

 

0
Ivan Danchev
Telerik team
answered on 11 Nov 2019, 01:50 PM

Hello Dhanushka,

Filtering treats dates as UTC, but when the dates are create on the client thy are offset based on the browser's local time (e.g. Australian Eastern Daylight time in your case). Thus, to ensure the timezones do not affect filtering, create the date object using UTC time instead of local time:  

"date": new Date(Date.UTC(2019, 10, 8))

This way date comparison won't fail because of timezone difference: screenshot.

Regards,
Ivan Danchev
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dhanushka
Top achievements
Rank 1
answered on 14 Nov 2019, 02:36 AM

Hi Ivan,

Why does the date picked from the date picker control is treated as UTC and not local?

Say if I pick 14/11/2019,

the date object should be Thu Nov 14 2019 00:00:00 GMT+1100 (Australian Eastern Daylight Time).

But Kendo treats this picked date as UTC and converts back to local. 

So that now it becomes, Thu Nov 14 2019 11:00:00 GMT+1100 (Australian Eastern Daylight Time).

The data will be fetched from an API which might return a date like "2019-11-14T00:00:00+11:00". If we need the filtering to process on this same data it's not going to work properly. But if the picker date is treated as local no conversions are required on the data.

What do you think?

*We have logged a support ticket (1442120) for this through our licensed account.

 

 

0
Ivan Danchev
Telerik team
answered on 15 Nov 2019, 03:28 PM

Hello Dhanushka,

After further investigation the discussed behavior has been logged for fixing.

Regards,
Ivan Danchev
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dhanushka
Top achievements
Rank 1
answered on 11 Feb 2020, 10:21 PM

Hi Ivan,

Is this fixed? Where can I find a status?

 

0
Ivan Danchev
Telerik team
answered on 13 Feb 2020, 04:48 PM

Hello Dhanushka,

Here's the respective but report item in our repo: https://github.com/telerik/kendo-vue/issues/42

The bug hasn't been fixed yet and at present its status is "unplanned". We have been working on other bugs with higher priority, so unfortunately we haven't planed the fix of this bug for a specific release yet.

Is the fix of this particular bug important to the project you are working on?

Regards,
Ivan Danchev
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Dhanushka
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Dhanushka
Top achievements
Rank 1
Share this question
or