0

i have the following function that i am trying to create that groups dates together so that i can get a total amount of cost for the group days as follows

function CreateDailyBalanceTable(result) {

  var groupdates = [];

  for (var i = 0; i < result.length; i++) {
    if (groupdates.indexOf(result[i].ResultDateTime.format("dd-MM-yyyy")) < 0) { //it keeps on throwing an error at this line
      groupdates.push(result[i].ResultDateTime.format("dd-MM-yyyy"));
    }
  }
}

this is an example of the result[i].ResultDateTime how it looks

"2015-08-13T11:41:51.147"

but when it reaches this line "if (groupdates.indexOf(result[i].ResultDateTime.format("dd-MM-yyyy")) < 0)" it breaks and says "result[i].ResultDateTime.format is not a function at eval (eval at CreateDailyBalanceTable)"

how do i fix this?

RobG
  • 134,457
  • 30
  • 163
  • 204
josh
  • 29
  • 5

0 Answers0