0๐
let timeObjects = ["03:57:58", "01:35:44", "01:01:01"];
let aggregate = timeObjects.map(t => t.split(':')).reduce((arr,item,index)=>{
arr[0]+= parseInt(item[0]);
arr[1]+= parseInt(item[1]);
arr[2]+= parseInt(item[2]);
if(arr[2]>60)
{
arr[1]++;
arr[2]%=60;
}
if(arr[1]>60)
{
arr[0]++;
arr[1]%=60;
}
return arr;
},[0,0,0])
.join(':')
- [Vuejs]-I am trying to load external JSON VueJS
- [Vuejs]-How to correctly reorder array when using computed properties with SortableJS and Vue?
Source:stackexchange.com