{"id":7868,"library":"workadays","title":"Workadays","description":"Workadays is a Python library designed for working with business days, calendar days, and 360-day basis (30/360) date calculations. It allows users to add business days to a given date, check if a specific date is a business day, and retrieve a list of holidays for various countries, states, and provinces. The library had its latest release on December 30, 2023, and generally follows an annual or semi-annual release cadence.","status":"active","version":"2023.12.30","language":"en","source_language":"en","source_url":"https://github.com/mfhorita/Workadays","tags":["date","business days","holidays","calendar","workdays"],"install":[{"cmd":"pip install workadays","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary functionality is exposed via the 'workdays' object, not the top-level package name.","wrong":"import workadays","symbol":"workdays","correct":"from workadays import workdays"},{"note":"Common typo: 'workadayS' (plural) is the correct package name, not 'workday' (singular). The latter is a different, unrelated library.","wrong":"from workday import workdays","symbol":"workdays","correct":"from workadays import workdays as wd"}],"quickstart":{"code":"import datetime as dt\nfrom workadays import workdays as wd\n\n# Example: Calculate the number of business days between two dates in Brazil\ndt_inicio = dt.date(2022, 9, 20)\ndt_atual = dt.date(2022, 12, 12)\n\n# You can also pass a list of custom holidays if needed\n# holidays = [dt.date(2022, 10, 12), dt.date(2022, 11, 2)]\n# n = wd.networkdays(dt_inicio, dt_atual, country='BR', holidays=holidays)\n\nn = wd.networkdays(dt_inicio, dt_atual, country='BR')\nprint(f\"Number of business days between {dt_inicio} and {dt_atual} in Brazil: {n}\")\n\n# Example: Add 5 business days to a date\nstart_date = dt.date(2024, 4, 15)\nfuture_date = wd.add_working_days(start_date, 5, country='US')\nprint(f\"5 business days after {start_date} in the US is: {future_date}\")\n\n# Example: Check if a date is a holiday\nis_holiday = wd.is_holiday(dt.date(2024, 12, 25), country='US')\nprint(f\"Is December 25, 2024 a holiday in the US? {is_holiday}\")","lang":"python","description":"This quickstart demonstrates how to calculate network days, add working days, and check for holidays using the `workadays` library. It emphasizes the importance of specifying the country for accurate holiday calculations."},"warnings":[{"fix":"Ensure your `pip install` command and `from ... import ...` statements use `workadays`.","message":"Be careful not to confuse `workadays` (plural) with the `workday` (singular) PyPI package. They are different libraries with distinct functionalities. Always ensure you install `workadays`.","severity":"gotcha","affected_versions":"All"},{"fix":"Always pass the `country` argument (e.g., `country='BR'`) to functions like `networkdays`, `add_working_days`, and `is_holiday`.","message":"When calculating business days or checking holidays, remember to specify the `country` parameter (and optionally `state` or `province`) to ensure accurate results, as holiday calendars are region-specific. The default country might not match your expectation.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `from workday import ...` to `from workadays import ...`.","cause":"Attempting to import from the incorrect package name 'workday' instead of 'workadays'.","error":"ModuleNotFoundError: No module named 'workday'"},{"fix":"Use `from workadays import workdays` (or `from workadays import workdays as wd`) and then call methods like `workdays.networkdays(...)` or `wd.networkdays(...)`.","cause":"You likely used `import workadays` and then tried to call methods directly on the `workadays` module. The core functions are typically exposed through the `workdays` object within the package.","error":"AttributeError: module 'workadays' has no attribute 'networkdays'"}]}