{"id":22222173,"url":"https://github.com/davewalker5/workingdayscalculator","last_synced_at":"2025-03-25T07:44:15.498Z","repository":{"id":132526256,"uuid":"238196149","full_name":"davewalker5/WorkingDaysCalculator","owner":"davewalker5","description":"Calculation of working days between two dates in C#","archived":false,"fork":false,"pushed_at":"2024-11-28T06:54:19.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T07:15:39.261Z","etag":null,"topics":["csharp","date","dotnet-core","workday","workdays"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davewalker5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-02-04T12:03:53.000Z","updated_at":"2024-11-28T16:46:47.000Z","dependencies_parsed_at":"2023-05-30T05:00:17.386Z","dependency_job_id":null,"html_url":"https://github.com/davewalker5/WorkingDaysCalculator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davewalker5%2FWorkingDaysCalculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davewalker5%2FWorkingDaysCalculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davewalker5%2FWorkingDaysCalculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davewalker5%2FWorkingDaysCalculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davewalker5","download_url":"https://codeload.github.com/davewalker5/WorkingDaysCalculator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245422921,"owners_count":20612725,"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":["csharp","date","dotnet-core","workday","workdays"],"created_at":"2024-12-02T23:17:17.523Z","updated_at":"2025-03-25T07:44:15.480Z","avatar_url":"https://github.com/davewalker5.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WorkingDaysCalculator\n \n[![Build Status](https://github.com/davewalker5/WorkingDaysCalculator/workflows/.NET%20Core%20CI%20Build/badge.svg)](https://github.com/davewalker5/WorkingDaysCalculator/actions)\n[![GitHub issues](https://img.shields.io/github/issues/davewalker5/WorkingDaysCalculator)](https://github.com/davewalker5/WorkingDaysCalculator/issues)\n[![Coverage Status](https://coveralls.io/repos/github/davewalker5/WorkingDaysCalculator/badge.svg?branch=master)](https://coveralls.io/github/davewalker5/WorkingDaysCalculator?branch=master)\n[![Releases](https://img.shields.io/github/v/release/davewalker5/WorkingDaysCalculator.svg?include_prereleases)](https://github.com/davewalker5/WorkingDaysCalculator/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/davewalker5/WorkingDaysCalculator/blob/master/LICENSE)\n[![Language](https://img.shields.io/badge/language-c%23-blue.svg)](https://github.com/davewalker5/WorkingDaysCalculator/)\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/davewalker5/WorkingDaysCalculator)](https://github.com/davewalker5/WorkingDaysCalculator/)\n\n## About\n\nThe WorkingDaysCalculator is a demonstration of calculating the number of working days between two days, assuming the weekend falls on Saturday and Sunday, using the following algorithm:\n\n![Working Days Algorithm](https://raw.githubusercontent.com/davewalker5/WorkingDaysCalculator/master/images/algorithm.png \"Working Days Algorithm\")\n\n* If the start date is a Sunday, move it back to the Saturday of the same weekend\n* If the start date is not a Saturday, roll it forward to the next Saturday, counting the number of working days required, _fs_\n* If the end date is not a Saturday, roll it forward to the next Saturday, counting the number of working days required, _fe_\n* Calculate the number of working days between the adjusted start and end dates\n* Divide by 7 to give the number of complete weeks, _w_\n* Calculate the number of working days as 5 * _w_ + _fs_ - _fe_ - 1\n\n## Getting Started\n\nThe following code snippet illustrates the use of the calculator to calculate the working days between two dates accounting for 2020 public holidays in England:\n\n```csharp\nDateTime[] bankHolidays =\n{\n    new DateTime(2020, 1, 1),\n    new DateTime(2020, 4, 10),\n    new DateTime(2020, 4, 13),\n    new DateTime(2020, 5, 8),\n    new DateTime(2020, 5, 25),\n    new DateTime(2020, 8, 31),\n    new DateTime(2020, 12, 25),\n    new DateTime(2020, 12, 28)\n};\n\nDateTime start = new DateTime(2020, 1, 24);\nDateTime end = new DateTime(2020, 4, 24);\n\nWorkingDaysCalculator calculator = new WorkingDaysCalculator();\nint days = calculator.Calculate(start, end, bankHolidays);\n\nConsole.WriteLine($\"There are {days} working days between {start.ToString(\"dd/MMM/yyyy\")} and {end.ToString(\"dd/MMM/yyyy\")}\");\n```\n\n## Authors\n\n- **Dave Walker** - *Initial work*\n\n## Feedback\n\nTo file issues or suggestions, please use the [Issues](https://github.com/davewalker5/WorkingDaysCalculator/issues) page for this project on GitHub.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavewalker5%2Fworkingdayscalculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavewalker5%2Fworkingdayscalculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavewalker5%2Fworkingdayscalculator/lists"}