cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Dates conversion after deploying app to the SCP

Former Member
0 Kudos

Hello experts,

I have the next problem. I use odata version 2 for my fiori app. One of the entities contains property with type Edm.DateTime. For filtering data by date i use the next syntax:

oDate = new Date()
<...>
new sap.m.List(sId, {
<...>
filters: [new Filter("DateOfWork", "EQ", oDate)]
}
});

for format output i use formatter function as ussally:

dateFormat: function(oValue) {
//date: dd.mm.yyyy
var day = oValue.getDate();
var month = oValue.getMonth(); 
}

In WEB ide it works fine, when i deploy to abap repository it works fine as well, BUT when i deploy it to cloud platform it doesn't work. at first i get en error, because date is not converted to format required by http request for date, so it is passed just like a string and of course it doesn't work.

Then in formatter, oValue in not of js type Date (like in web ide), but string like "/Date(1404860400000)/"

I thought that probably issue is in models, but model looks the same. Do you have any idea? what can be a reason?


Best Regards,

Mikhail

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Have you compared the results from odata requests made from WebIDE and from SCP's deployed app? Could this be a cache problem?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hey Mihail,

The format you specified Date(1404860400000) is a milliseconds format of data object.

The value can be accessed by following code

var a = new Date(1404860400000);

or in your case

dateFormat:function(oValue){//date: dd.mm.yyyy

var newDate = new Date(oValue);
var day = newDate.getDate();
var month = newDate.getMonth();}

you could use this way of accessing inside your dateFormat formatter. Hope this helps.


Regards,

Karthik.