{"id":21409824,"url":"https://github.com/stackbuilders/workdays","last_synced_at":"2025-03-16T17:45:08.380Z","repository":{"id":56882676,"uuid":"63717056","full_name":"stackbuilders/workdays","owner":"stackbuilders","description":"Workday calculations in Haskell.","archived":false,"fork":false,"pushed_at":"2016-11-17T16:38:43.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-23T08:48:15.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/stackbuilders.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-19T18:09:01.000Z","updated_at":"2019-12-05T06:34:49.000Z","dependencies_parsed_at":"2022-08-20T22:31:01.446Z","dependency_job_id":null,"html_url":"https://github.com/stackbuilders/workdays","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fworkdays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fworkdays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fworkdays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fworkdays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackbuilders","download_url":"https://codeload.github.com/stackbuilders/workdays/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910690,"owners_count":20367538,"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":[],"created_at":"2024-11-22T17:34:30.697Z","updated_at":"2025-03-16T17:45:08.347Z","avatar_url":"https://github.com/stackbuilders.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Workdays: Workday calculations in Haskell\n\n\u003e “Let us sit here for five minutes and think of nothing.”\n\nThe workdays library allows to do workday (and weekday) calculations\nin Haskell.\n\nBased on the [workdays](https://pypi.python.org/pypi/workdays/) Python\npackage.\n\n## Examples\n\n(Tested with GHC 8.0.1.)\n\nIn order to use the workdays library, import the Workdays module:\n\n```\nλ\u003e import Workdays\n```\n\nTo specify dates, we need to create values of `Date` using the `Date`\nconstructor:\n\n```\nλ\u003e :type Date\nDate :: Year -\u003e Month -\u003e DayOfMonth -\u003e Date\n```\n\nA value of type `Date` is a year (`Integer`), a month (`Int`), and a\nday of month (`Int`).\n\nHere's December 1, 2016:\n\n```\nλ\u003e Date 2016 12 01\nDate {dateYear = 2016, dateMonth = 12, dateDay = 1}\n```\n\nThe `workdays` function is used to calculate the number of workdays\nbetween two dates:\n\n```\nλ\u003e :type workdays\nworkdays :: Date -\u003e Date -\u003e Set Date -\u003e Integer\n```\n\nThis function takes start and end dates, and a set of dates to\nexclude.\n\nLet's calculate the number of workdays between December 1, 2016 and\nDecember 31, 2016 without excluding dates:\n\n```\nλ\u003e workdays (Date 2016 12 01) (Date 2016 12 31) []\n22\n```\n\nIf there are no dates to exclude, we're calculating weekdays. We can\nuse the `weekdays` function instead:\n\n```\nλ\u003e weekdays (Date 2016 12 01) (Date 2016 12 31)\n22\n```\n\nTo create sets of dates, we need to import the `Set` data type from\nthe containers library:\n\n```\nλ\u003e import Data.Set (Set)\n```\n\nAnd we can activate the overloaded lists language extension to create\nsets as lists:\n\n```\nλ\u003e :set -XOverloadedLists\n```\n\nLet's use some holidays in Colombia as examples. For now, just\nChristmas Day:\n\n```\nλ\u003e holidays = [Date 2016 12 25] :: Set Date\n```\n\nWe can use this set as the set of dates to exclude from the workdays\ncalculation:\n\n```\nλ\u003e workdays (Date 2016 12 01) (Date 2016 12 31) holidays\n22\n```\n\nUnfortunately, Christmas Day is a Sunday, so the result is still 22.\nSome countries observe Christmas Day on Monday, but not Colombia.\n\nLet's add December 8, 2016 (the Feast of the Immaculate Conception) to\nthe set of dates to exclude:\n\n```\nλ\u003e holidays = [Date 2016 12 08, Date 2016 12 25] :: Set Date\n```\n\nAnd try again:\n\n```\nλ\u003e workdays (Date 2016 12 01) (Date 2016 12 31) holidays\n21\n```\n\nThe result is now 21, which is the actual number of workdays for\nDecember, 2016 in Colombia.\n\n## License\n\nLicensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fworkdays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackbuilders%2Fworkdays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fworkdays/lists"}