{"id":18614950,"url":"https://github.com/andrewjbateman/javascript-add-times","last_synced_at":"2026-05-19T07:33:52.879Z","repository":{"id":96860385,"uuid":"160633213","full_name":"AndrewJBateman/javascript-add-times","owner":"AndrewJBateman","description":":clipboard: Add video times to give a total time. Wes Bos Javascript30 Youtube Tutorial 18. ","archived":false,"fork":false,"pushed_at":"2022-04-10T09:59:33.000Z","size":253,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T02:45:04.468Z","etag":null,"topics":["css","html5","javascript30","tutorial-exercises"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-06T07:01:37.000Z","updated_at":"2022-04-10T09:59:36.000Z","dependencies_parsed_at":"2023-05-16T22:30:50.430Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/javascript-add-times","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fjavascript-add-times","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fjavascript-add-times/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fjavascript-add-times/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fjavascript-add-times/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/javascript-add-times/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239406449,"owners_count":19633024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","html5","javascript30","tutorial-exercises"],"created_at":"2024-11-07T03:27:38.014Z","updated_at":"2025-10-03T13:23:27.010Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Javascript Local Storage\n\n* Wes Bos Youtube Javascript30 tutorial: [How JavaScript's Array Reduce Works - #JavaScript30 18/30](https://www.youtube.com/watch?v=SadWPo2KZWg\u0026list=PLu8EoSxDXHP6CGK4YVJhL_VWetA865GOH\u0026index=18).\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/javascript-add-times?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/javascript-add-times?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/javascript-add-times?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/javascript-add-times?style=plastic)\n\n## :page_facing_up: Table of contents\n\n\n* [:zap: Javascript Add Times](#zap-javascript-add-times)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:wrench: Testing](#wrench-testing)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* Tutorial Code to understand how to sum time strings using the reduce function.\n\n## :camera: Screenshots\n\n![Example screenshot](./img/vids.png).\n\n## :signal_strength: Technologies\n\n* [Javascript ECMA-262 ECMAScript 2021](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\n\n## :floppy_disk: Setup\n\n* Open index.html in browser. If any code is changed the browser needs to be refreshed.\n\n## :computer: Code Examples\n\n* Use map, split and reduce functions to obtain total seconds then convert to hours, moins and seconds.\n\n```javascript\n// turn secs:mins nodes into an array of strings then split into mins secs\n// then use parsefloat function to return an array of numbers.\n// then convert to a total seconds value\n// then use reduce function to produce a total in seconds.\nconst seconds = timeNodes\n  .map(node =\u003e node.dataset.time)\n  .map(timeCode =\u003e {\n    const [mins, secs] = timeCode.split(':').map(parseFloat);\n    return (mins * 60) + secs;\n  })\n  .reduce((total, vidSeconds) =\u003e total + vidSeconds)\n\n  let secondsLeft = seconds;\n  const hours = Math.floor(secondsLeft / 3600);\n  secondsLeft = secondsLeft % 3600; // leftover from minutes is seconds\n  \nconst mins = Math.floor(secondsLeft / 60);\nsecondsLeft = secondsLeft % 60;\n```\n\n## :cool: Features\n\n*  Gives total video play time in hours, mins \u0026 secs.\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Working.\n* To-Do: This code can be enhanced with HTML to show the time values from the javascript calculations.\n\n## :clap: Inspiration\n\n* Wes Bos Youtube Javascript30 tutorial [How JavaScript's Array Reduce Works - #JavaScript30 18/30](https://www.youtube.com/watch?v=SadWPo2KZWg\u0026list=PLu8EoSxDXHP6CGK4YVJhL_VWetA865GOH\u0026index=18)\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fjavascript-add-times","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fjavascript-add-times","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fjavascript-add-times/lists"}