-1

I am using SAPUi5 for Time.The time fValue is PT12H50M00S.When showing on dropdownbox it is showing Nan,result is shown as NaN:NaN:NaN PM,How to convert this to values.

var oItemTemplate2 = new sap.ui.core.ListItem({
  text: {
    path: "SlotTi",
    formatter: function(fValue) {
      jQuery.sap.require("sap.ui.core.format.DateFormat");
      var oTimeFormat = sap.ui.core.format.DateFormat.getTimeInstance({
        pattern: "KK:mm:ss a"
      });
      if (fValue != undefined || fValue != null) {
        fValue = fValue.toString();
      }
      return oTimeFormat.format(new Date(fValue));
    }
  }
});
Durga
  • 15,263
  • 2
  • 28
  • 52
Rohit
  • 34
  • 2
  • 14

1 Answers1

0

I am able to resolve that issue using below code, But with this the dropdown is showing the same time for every value.

SlotTi: "PT08H00M00S" SlotTi: "PT08H10M00S"

The value shown is 3:00:00

What is missing to show the values.

   var oItemTemplate2 = new sap.ui.core.ListItem(
          {
            text :
            {
              path:"SlotTi",
              formatter : function(fValue)
              {
                jQuery.sap.require("sap.ui.core.format.DateFormat");
                var oTimeFormat = sap.ui.core.format.DateFormat.getTimeInstance(
                    {
                      pattern: "KK:mm:ss a"
                    });
                if( fValue != undefined || fValue != null){
                  fValue = Date(oTimeFormat.parse(fValue));
                }
                return oTimeFormat.format(new Date(fValue));
              }
            }
          });
      oItemTemplate2.bindProperty("enabled", "enabled");
      dropbox.bindItems("/d/results", oItemTemplate2);
Greg Pettit
  • 10,749
  • 5
  • 53
  • 72
Rohit
  • 34
  • 2
  • 14