on 04-12-2018 7:43 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.