Last active
August 27, 2018 19:47
-
-
Save clarkwinkelmann/62e8f35fc0e8c3f4b4d17fa83b782052 to your computer and use it in GitHub Desktop.
Get total time for all events matching search request in Google Calendar webapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { let total = 0; for (let i=0, times=document.querySelectorAll('.vXnnM');i<times.length; i++) { let hours = times[i].innerText.split('à'); duration = (Date.parse('2017-01-0' + (parseInt(hours[0]) > parseInt(hours[1]) ? '2' : '1') + ' ' + hours[1]) - Date.parse('2017-01-01 ' + hours[0])); /*console.log(duration/60000);*/ total += duration; } let totalMinutes = total / 60000; return Math.floor(totalMinutes / 60) + ':' + (totalMinutes % 60); })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment