Task: Calculate total time spent in meetings every week

n8n workflow JSON:
{"name":"","nodes":[{"name":"Weekly Trigger","type":"n8n-nodes-base.cron","position":[480,840],"parameters":{"triggerTimes":{"item":[{"hour":18,"mode":"everyWeek","weekday":"5"}]}},"typeVersion":1},{"name":"Start and end of week","type":"n8n-nodes-base.function","position":[710,840],"parameters":{"functionCode":"var curr = new Date;\nvar first = (curr.getDate() - curr.getDay()) +1;\nvar last = first + 4;\n\nvar firstday = new Date(curr.setDate(first));\nvar lastday = new Date(curr.setDate(last));\n\nbeginning_week = new Date(firstday.setHours(0,0,0,0));\nending_week = new Date(lastday.setHours(23,59,59,99));\n\nitems[0].json.from = beginning_week.toISOString();\nitems[0].json.to = ending_week.toISOString();\n\nreturn items;"},"typeVersion":1},{"name":"Meetings this week","type":"n8n-nodes-base.googleCalendar","position":[910,840],"parameters":{"options":{"timeMax":"","timeMin":""},"calendar":"","operation":"getAll","returnAll":true},"credentials":{"googleCalendarOAuth2Api":""},"typeVersion":1},{"name":"Total meeting duration","type":"n8n-nodes-base.function","position":[1110,840],"parameters":{"functionCode":"var new_items = [];\nvar total_meeting_time = 0;\n\nfor (var i=0 ; i<items.length ; i++) {\n  var duration = 0;\n  duration = new Date(items[i].json.end.dateTime).getTime() - new Date(items[i].json.start.dateTime).getTime();\n  total_meeting_time = total_meeting_time + duration;\n}\n\nnew_items.push({json: {total_meeting_time: (total_meeting_time/(1000*60*60)).toFixed(1)}});\n\nreturn new_items;"},"typeVersion":1},{"name":"Plivo","type":"n8n-nodes-base.plivo","position":[1300,840],"parameters":{"to":"+","from":"+","message":"=Total Time spent in meetings this week is: {{$node[\"Total meeting duration\"].json[\"total_meeting_time\"]}} hours."},"credentials":{"plivoApi":""},"typeVersion":1}],"active":false,"settings":{},"connections":{"Weekly Trigger":{"main":[[{"node":"Start and end of week","type":"main","index":0}]]},"Meetings this week":{"main":[[{"node":"Total meeting duration","type":"main","index":0}]]},"Start and end of week":{"main":[[{"node":"Meetings this week","type":"main","index":0}]]},"Total meeting duration":{"main":[[{"node":"Plivo","type":"main","index":0}]]}}}