0

I do have a List<MyObjects> where MyObject contains a property which is DateOnly.

At the end of my service I want to apply some DevExtreme.AspNet.Mvc.DataSourceLoadOptions on the List:

return DataSourceLoader.Load(myList, loadOptions);

The loadOptions contain a group:

[{"selector":"myInformation.dateOnlyProperty","groupInterval":"year","isExpanded":true},
{"selector":"myInformation.dateOnlyProperty","groupInterval":"month","isExpanded":true},
{"selector":"myInformation.dateOnlyProperty","groupInterval":"day","isExpanded":false}]

The dateOnlyProperty was a DateTime before (which worked) and now it is DateOnly (doesn't work).

The returned error-message is:

Unable to cast object of type 'System.DateOnly' to type 'System.IConvertible'.

How can I add that needed cast for DevExtreme.AspNet.Data.DataSourceLoader.Load(...)? Or is there any other recommended solution?

Stix
  • 455
  • 5
  • 16
  • I'm not sure that `DateOnly` works with DevExtreme, I suggest you try with `TimeSpan` instead – K. A. Dec 05 '22 at 19:39

0 Answers0