now there is an array: now we need to calculate the time difference between the first data and the second data, the time difference between the second and the third, and so on, and there are many pieces of data that are not fixed
. historyList: [{
id:1,
date:"2019-01-18 14:08"
},{
id:2,
date:"2019-01-19 14:08"
},{
id:3,
date:"2019-01-20 14:08"
}]
I have no idea at this point: I don"t know how to subtract two adjacent items.
if (ctx.historyList.length > 1) {
ctx.historyList.forEach((item, index) => {
console.log(ctx.historyList[index].date)
})
}