I have a table which works as expected, show all the data that falls between start and end dates(please look on comments for more info). only issue I am having right now is when I click next button on a table, the table header moves dates to next week dates and shows the data for that week but also it shows the data from last week as well. what I needed was if it goes to next week date it should show data only for that week (no rows/data from last week).
//this is only an eg:
function test() {
  //this is the table header start date(in pic)6/4/17
  var test1 = document.getElementById("testing").innerHTML;
  //this is the table header close date(in pic)6/10/17
  var test2 = document.getElementById("testin").innerHTML;
  //this is the function if dates is between start and end its displays the data in a tabel
  function dateInRange(dbdates, start, end) {
    if (end >= dbdates && start <= dbdates) {
      return true;
    } else {
      return false;
    }
  }
  var columns = ['orange']
  var table = document.getElementById('tablet');
  for (var i = 0; i < (testvalues.length - 1); i = i + 5) { //looping all values from db
    if (dateInRange(testvalues[i + 2], test1, test2)) {
      var row = table.insertRow(-1);
      var cell1 = row.insertCell(-1);
      var cell2 = row.insertCell(-1);
      //more logic 
      //this is just an ex:
      //this is next button on table
      $("next").click(
        test();
      }
 
     
     
     
    