Unplanned
Last Updated: 19 Sep 2025 11:53 by ADMIN
David
Created on: 14 Sep 2025 08:59
Category: KendoReact
Type: Feature Request
3
Date-only filters from toODataString

We are using the DateFilter from kendo-react-data-tools to filter Odata Edm.Date fields. Neither the DateFilter nor the Edm.Date fields have a time component, but toODataString from kendo-data-query turns the DateFilter value into a DateTimeOffset e.g. YYYY-MM-DDT00:00:00.000Z.

Is it possible to get a date-only value from toODataString using DateFilter?

1 comment
ADMIN
Vessy
Posted on: 19 Sep 2025 11:53

Hi, David,

Thanks a lot for the submitted feature request - we will monitor the interest in it closely!

Currently, there is no built-in configuration in toODataString to output date-only strings for Edm.Date fields. The toODataString method from @progress/kendo-data-query always serializes JavaScript Date objects as full date-time strings (e.g., "YYYY-MM-DDT00:00:00.000Z"), even when the target field in OData is of type Edm.Date, which expects a date-only value ("YYYY-MM-DD").

To generate a date-only value, you can try to manually format your filter value before passing it to toODataString in a similar way:

const dateToEdmDate = (date) => date.toISOString().slice(0, 10);

const filter = {
  logic: 'and',
  filters: [
    {
      field: 'FirstOrderedOn',
      operator: 'eq',
      value: dateToEdmDate(selectedDate), // selectedDate is a JS Date object
    },
  ],
};

const odataString = toODataString(filter);

    Kind Regards,
    Vessy
    Progress Telerik

    Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.