Trying to add day by day when adding new row in vue js

  javascript, laravel, vue.js

This is my dynamic input field. Im only a begginer in vue js

<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th> <button type="button" class="btn btn-sm btn-primary"  @click="addRow">+</button></th>
</tr>
</thead>
 <tbody>
      <tr v-for="(row, index) in rows" :key="row.id">
        <td><input type="date" style="width:170px;" class="form-control" v-bind:value="row.date = 
        AddingDate(row.date)"> </input></td
        <td><input type="time" class="form-control" v-model="row.time_in"> </input></td>
        <td><input type="time" class="form-control" v-model="row.time_out"></input></td>
        <td><button type="button" @click="removeElement(index);" class="btn btn-danger btn-sm">X</button></td>
      </tr>
    </tbody>
</table>

In my methods, not adding day by day it add like more than a month I don’t know why

  addRow() {
        
        this.rows.push({
          time_in:"07:00",
          time_out:"16:00",
          date:'2020-09-17',
        })
    
      },

   AddingDate(value){
        var date = new Date(value)
        let newdate = date.setDate(date.getDate() + 1)
        return  new Date(newdate).toISOString().slice(0,10)

        },

Source: Laravel

Leave a Reply