Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Date issue "Uncaught TypeError: d.getDay is not a function"

Hi All,

I am trying to modify date format in a dialogue that is being called from view. following is the code from view and controller.

toolbar: new sap.ui.commons.Toolbar({

                items: [

new sap.ui.commons.Button('edit_btn',{

                        text: "Edit Note",

                        icon: "sap-icon://edit",

                        enabled: false,

                        press: oController.editNotePress.bind(oController)

                    }),

Code from Controller:

var fileTable = sap.ui.getCore().byId('noteFileTable');

var json = JSON.parse(fileTable.getModel().getJSON());

            for (var i = 0; i < indices.length; i++) {

                var context = searchTable.getContextByIndex(indices[i]).getPath();

                var model = searchTable.getModel();

                var obj = model.getProperty(context);

                obj.__metadata = null;

                if (!doFilesContainFile(json.results, obj)) {

                    json.results.push(obj);

                }

            }

            fileTable.getModel().setData(json);

            fileTable.bindRows("/results");

   addTableColumn(fileTable, "ACTIVATED_AT", "Activated at");

All I need to do is to modify "Activated at" field to display in format "yyyy-MM-dd HH:mm:ss.ms"

I have used date formatter at another place but its not working here. When I tried following code, the popup is not getting displayed.

  addTableColumn(new sap.ui.table.Column({

            label: new sap.ui.commons.Label({

                text:  "Activated at"

            }),

        //Date modification   

             template: new sap.ui.commons.TextView().bindProperty("text", {                         

             path: 'ACTIVATED_AT',

             type: new sap.ui.model.type.Date({pattern:"yyyy-MM-dd HH:mm:ss.ms"})

            })

        }));

Any help would be much appreciated.

Regards

Uday

Not what you were looking for? View more on this topic or Ask a question