{"id":3450,"library":"dateutils","title":"dateutils - Wrapper for Advanced Datetime Arithmetic","description":"The `dateutils` library provides various utilities for working with date and datetime objects. It acts as a lightweight wrapper over the more comprehensive `python-dateutil` library, offering specialized features like advanced arithmetic operations, date range generation, and business day calculations. The last release was version 0.6.12 in October 2020.","status":"maintenance","version":"0.6.12","language":"en","source_language":"en","source_url":"https://github.com/jmcantrell/python-dateutils","tags":["datetime","date","utilities","wrapper","date-arithmetic"],"install":[{"cmd":"pip install dateutils","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"This library is a wrapper that heavily relies on `python-dateutil` for its core datetime manipulation features.","package":"python-dateutil","optional":false}],"imports":[{"note":"The `dateutils` package (this entry) exposes its primary functionality through `dateutils.api.DateUtils`, not directly as `dateutil`. `dateutil` is the import name for the separate, more widely used `python-dateutil` library.","wrong":"import dateutil","symbol":"DateUtils","correct":"from dateutils.api import DateUtils"}],"quickstart":{"code":"from datetime import datetime, date\nfrom dateutils.api import DateUtils\n\n# Calculate the difference between two dates\ndate1 = date(2023, 1, 1)\ndate2 = date(2023, 1, 15)\ndiff_days = DateUtils.diff(date1, date2).days\nprint(f\"Difference in days: {diff_days}\")\n\n# Generate a date range\nstart_date = date(2023, 3, 1)\nend_date = date(2023, 3, 5)\ndates_in_range = list(DateUtils.range(start_date, end_date))\nprint(f\"Dates in range: {dates_in_range}\")","lang":"python","description":"This quickstart demonstrates how to use the `DateUtils` API to calculate the difference between two dates and generate a range of dates, showcasing common functionalities provided by this wrapper library."},"warnings":[{"fix":"If intending to use the core `dateutil` functionalities (parsing, `relativedelta`, timezones), install `python-dateutil` (`pip install python-dateutil`). If you specifically require the wrapper features of *this* `dateutils` library, be mindful of its lower maintenance status and explicit import path.","message":"Potential confusion with `python-dateutil`: This library, `dateutils` (without the hyphen in the package name, `pip install dateutils`), is a distinct, less actively maintained package. It acts as a wrapper around the much more widely used and actively developed `python-dateutil` library (installed via `pip install python-dateutil`, imported as `import dateutil`). Always ensure you are installing and importing the correct library for your needs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For general robust datetime handling, parsing, and relative deltas, consider using `python-dateutil` directly (version 2.x and above) or Python's built-in `datetime` and `zoneinfo` modules (for Python 3.9+). If specific functionalities of this `dateutils` wrapper are essential, be prepared to adapt or maintain the code yourself.","message":"Project Maintenance Status: The `dateutils` library (jmcantrell/python-dateutils) has not seen a new release since October 2020. While functional, it relies on `python-dateutil` for its core logic, which is actively maintained. Users should be aware that direct support or new features for `dateutils` itself are unlikely.","severity":"deprecated","affected_versions":"0.6.12 and earlier"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}