{"id":16255761,"url":"https://github.com/matsmaker/time-by-schedule","last_synced_at":"2026-04-30T09:38:01.401Z","repository":{"id":75775183,"uuid":"99112267","full_name":"MatsMaker/time-by-schedule","owner":"MatsMaker","description":null,"archived":false,"fork":false,"pushed_at":"2017-12-20T21:52:50.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T09:33:07.135Z","etag":null,"topics":["javascript","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/MatsMaker.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":"2017-08-02T12:07:09.000Z","updated_at":"2017-08-02T12:26:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"b5a078d2-ba43-417b-9cf8-93a3cabcb42a","html_url":"https://github.com/MatsMaker/time-by-schedule","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"8efeb4a12fdf2865a4502dacff612d7320199a46"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatsMaker%2Ftime-by-schedule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatsMaker%2Ftime-by-schedule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatsMaker%2Ftime-by-schedule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatsMaker%2Ftime-by-schedule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatsMaker","download_url":"https://codeload.github.com/MatsMaker/time-by-schedule/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847610,"owners_count":21006100,"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":["javascript","nodejs"],"created_at":"2024-10-10T15:43:46.606Z","updated_at":"2026-04-30T09:38:01.370Z","avatar_url":"https://github.com/MatsMaker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Time by schedule\n\nSmall utility for calculate work time by schedule\n\nnpm package https://www.npmjs.com/package/@mats-maker/schedule-calendar\n\n### Example:\n\nWe have week schedule with exceptions:\n\n```javascript\n          [\n            {\n                indexOfday: 0,   // Index of day\n                from: 28800,     // 8:00 AM Start of work day this is number seconds from start the day\n                to: 63000,       // 5:30 PM End of work day this is number seconds from start the day\n                isActive: true   // Toggler - active or not active this day. Possibly will need when schedule will be editing and need show some time\n            }, {\n                indexOfday: 1,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, \n            ...\n            ...\n            {\n                indexOfday: 4,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, {\n                indexOfday: 5,\n                from: null,   // saturday is day of rest\n                to: null,     // saturday is day of rest\n                isActive: false\n            }, {\n                indexOfday: 6,\n                from: null,   // sunday is day of rest\n                to: null,     // sunday is day of rest\n                isActive: false\n            }\n        ],\n        exceptions: [{\n            date: '2017-04-19T08:45:56.053Z',\n            from: 28800,\n            to: 63000,\n            isActive: false\n        }, {\n            date: '2017-04-20T08:45:56.053Z',\n            from: 32400,\n            to: 50400,\n            isActive: true\n        }\n```\n We will have **from 2017-04-16T14:00:00 to 2017-05-01T14:00:00 result 87:00 work time**, has two exceptions on different week\n \n \n ## How it use\n\n```javascript\nconst shedule = {\n        week: [\n            {\n                indexOfday: 0,          // Index of day 0-6\n                from: 28800,            // Start of work day this is number seconds from start the day\n                to: 63000,              // End of work day this is number seconds from start the day\n                isActive: true\n            }, {\n                indexOfday: 1,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, {\n                indexOfday: 2,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, {\n                indexOfday: 3,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, {\n                indexOfday: 4,\n                from: 28800,\n                to: 63000,\n                isActive: true\n            }, {\n                indexOfday: 5,\n                from: null,\n                to: null,\n                isActive: false\n            }, {\n                indexOfday: 6,\n                from: null,\n                to: null,\n                isActive: false\n            }\n        ],\n        exceptions: [] // also you can set exceptions\n    };\nconst timetable = new Timetable(shedule);\nconst startTimeDuration = 1492437600                              // 2017-04-17T14:00:00\nconst endTimeDuration = 1492448400                                // 2017-04-17T20:00:00\nconst result = timetable.timeOfDuration(1492437600, 1492448400)); // 12600 this is 3:30 work's time by shedule\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatsmaker%2Ftime-by-schedule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatsmaker%2Ftime-by-schedule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatsmaker%2Ftime-by-schedule/lists"}