Hi Swapna,
I do not think of any issue is there in the code.
Please check whether there is some layout issue or something else.
Also try using percentage in width attribute.
the below code works perfectly for me...
var oModelDate = new sap.ui.model.json.JSONModel();
oModelDate.setData({
dateValue: new Date(new Date().getTime()-(1*24*60*60*1000)),
});
var oDatePicker = new sap.ui.commons.DatePicker("date",{
width: "10em",
value: {
path: "/dateValue",
type: new sap.ui.model.type.Date({pattern: "MM/dd/yyyy"})
}
});
oDatePicker.setModel(oModelDate);
Thanks and Regards,
Ushinar