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"/>


    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+"'") );

                        placeholder="Select ..."
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 () sap.ui.model.odata.v4.ODataBinding

Accepted Solutions (0)

Answers (0)