I'm expecting to compute total time by subtracting date and time from separated object keys in the data array. Hense I'm having a static start and end date format 'yy-mm-dd' and time format '01:02:30'. And I need to compute its time difference. But I'm not sure if the syntax is ok.
data (
return {
shifts: [
{
id: '1',
start_date: '2022-04-23',
start_time: '19:32:00',
end_date: '2022-05-23',
end_time: '07:32:00'
},
{
id: '2',
start_date: '2022-04-23',
start_time: '19:32:00',
end_date: '2022-05-23',
end_time: '07:32:00'
}
]
}
)
computed: {
totalShiftTime () {
return this.shifts.forEach(t => (t.end_date + t.start_time) - (t.end_date + t.start_time))
// expecting to return smth like 11:12:32 format // means total time
}
}