cancel
Showing results for 
Search instead for 
Did you mean: 

Fail to filter date in Sapui5 unsupported data type

0 Kudos

I have an error filtering by date with another different format.

I am filtering perfectly from the date field CreateDate from BusinessPartners in Services Layer of type Edm.DateTimeOffset

<Property Name="CreateDate" Type="Edm.DateTimeOffset"/>

Controller

    onSearch: function(oEvent) {
        var oFilterModel = this.getView().getModel("filters");

        var sDate= oFilterModel.getProperty("/datefrom");
        var sDate2 = oFilterModel.getProperty("/dateto");

        if(date) {
            // formatear fecha 
            var oDateFormat = sap.ui.core.format.DateFormat.getInstance({
              pattern : "yyyy-dd-MM"
            });
            var from= oDateFormat.format(new Date(sDate));
            var to= oDateFormat.format(new Date(sDate2));
            aFilters.push( new sap.ui.model.Filter("CreateDate", sap.ui.model.FilterOperator.BT,  "'"+from+"'", "'"+to+"'") );
        }

   }
View
                    <DateRangeSelection
                        placeholder="Select ..."
                        dateValue="{path:'filters>/datefrom'}"
                        secondDateValue="{path:'filters>/dateto'}"
                    />
Now, when I connect to another database, with the date field CreateDate is of type Edm.DateTime
<Property Name="CreateDate" Type="Edm.DateTime"/>
I get the following error
Error in hasPendingChangesForPath - Error: Unsupported type: Edm.DateTime ...... ... ... at Array.map () sap.ui.model.odata.v4.ODataBinding

Accepted Solutions (0)

Answers (0)