I'm using the sap.m.ObjectStatus as part of my status display on a given agregated list:
in view.js:
var curstat = new sap.m.ObjectStatus({
//text: "{CountDate}",
//text: oController.formatDate('{CountDate}'),
state: "Success",
text: {
parts:[{path:'CountDate'}],
formatter: 'oController.formatterCountDate'
}
});
snippet in the controller.js, the format of the CountDate value is, yyyy-mm-ddT00:00:00. goal is to remove the time part leaving only YYYY-MM-DD. I don't get any exception thrown and the date does show just not in the format I want. I feel I'm close but just can't get figure out what I may be over looking. Thanks in advance for the help.
formatterCountDate:function(t) {
try {
var d = new Date();
var T = new sap.ui.model.type.Date( {
source : {
pattern : "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
},
pattern : "yyyy,MM,dd",
style : "medium"
});
d = T.formatValue(t, "string");
var D = new Date(d);
return D
}//try
catch(error) {
alert(error.message);
}
},