I'm having troubles to get this simple formatter to work, and I don't know what's wrong.
ap.ui.jsview("splitapp.DetailPage", {
getControllerName: function() {
return "splitapp.DetailPage";
},
createContent: function(oController) {
jQuery.sap.require("sap.ui.core.format.DateFormat");
var oType = new sap.ui.model.type.DateTime({
source: {
pattern: "yyyy-MM-dd HH:mm:ss Z"
}
});
var oDateFormat = sap.ui.core.format.DateFormat.getInstance({
pattern: "MM/dd/yyyy"
});
oLayout.createRow(new sap.ui.commons.TextView({
text: "Fecha de apertura",
design: sap.ui.commons.TextViewDesign.Bold
}),
new sap.ui.commons.TextView({
text: {
path: "ticketSelected>/fechaApertura",
type: oType,
formatter: function(d) {
return oDateFormat.format(new Date(d))
}
}
})
);
}
});
the only problem would be your
d
value in formatter would be""
empty string..Working JSFiddle here