2

I have a similar question like this here or here. I am using an XML view, too. With this code

<Text text="{ path: 'model1>CHANGE_DATE' }" />

I get the following response from the OData (V2) service:

/Date(1671944676355)/

When I try

<Text text="{
  path: 'model1>CHANGE_DATE', 
  type: 'sap.ui.model.type.Date', 
  formatOptions: { pattern: 'MM/dd/yyyy' }
}"/>

I receive the error message:

sap-ui-core-dbg.js:30928 Uncaught TypeError: oDate.getTime is not a function

Do you have any idea why the formatting did not work?

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Dan_
  • 41
  • 1
  • 4
  • Is this an ODataModel? Is the field declared as Edm.DateTime? – cschuff Aug 23 '16 at 11:49
  • Ah ok. I am using a JsonModel. Perhaps this is the reason. I can try to convert to OdataModel - if necessary. – Dan_ Aug 23 '16 at 12:33
  • Guess this is the reason. You could also switch to another date format or use a formatter function to convert the string to a JS Date object – cschuff Aug 23 '16 at 12:38

1 Answers1

2

Converting to ODataModel solved this issue.

Dan_
  • 41
  • 1
  • 4