datedelta
Like datetime.timedelta, for date arithmetic.
What it is and what it does
datedelta is a small library that adds calendar-aware date arithmetic to Python's standard datetime module. Where datetime.timedelta works with fixed day counts, datedelta lets you add or subtract years, months, weeks, and days from dates while respecting the Gregorian calendar's quirks—leap years and variable month lengths. When arithmetic would land on a non-existent date (like February 30th), it rolls forward to the first day of the next month, ensuring consistent and predictable results.
The library is designed for subscription billing, recurring events, and any scenario where you need to add a human-readable period ("3 months", "1 year") to a date and get a sensible result. It provides both simple constants (YEAR, MONTH, WEEK, DAY) for common operations and a flexible datedelta class for arbitrary combinations. The package has no external dependencies and supports Python 3.6 through 3.10.
Use it for:
- Calculate subscription renewal dates that account for leap years and month-end edge cases
- Add or subtract calendar months/years from dates without losing precision to day-of-month mismatches
- Generate recurring event schedules that respect calendar boundaries (e.g., monthly billing on the 31st)
- Handle date arithmetic in financial or legal contexts where calendar precision matters
- Compute date ranges for reports or periods that span variable-length months or leap years
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
datedelta extends Python's datetime module with calendar-aware date arithmetic for years, months, weeks, and days, handling leap years and variable month lengths correctly.
Yes. This is a stable, production-ready library (Development Status 5) with no security vulnerabilities, zero dependencies, and low install friction. It solves a real problem that datetime.timedelta cannot—calendar-aware arithmetic—and is well-suited for billing, scheduling, and any date math that must respect human calendar conventions. The aging maintenance status is not a blocker for a focused, mature library with no active vulnerabilities.
Install
datedelta on PyPI
pip
pip install datedeltauv
uv add datedeltapoetry
poetry add datedeltaInstalling datedelta
Before you install
Low install friction with no runtime dependencies. Last release was in 2022 and the repository shows activity as of 2026-01-05, though the package is classified as aging with 1686 days since the last release.
License in practice
BSD-3-Clause is a permissive license allowing commercial and private use with minimal restrictions, making this safe for most projects.
Quickstart
import datetime
import datedelta
# Add 3 months to a date
result = datetime.date(2025, 4, 22) + 3 * datedelta.MONTH
print(result) # datetime.date(2025, 7, 22)
# Subtract a year from a leap day
result = datetime.date(2024, 2, 29) - datedelta.YEAR
print(result) # datetime.date(2023, 3, 1)
Verify before relying
- Whether the package receives active maintenance or is in maintenance-only mode despite recent repository commits
- Performance characteristics when used with large date ranges or in tight loops
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.6,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 1,686 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 145,271/month — #11,131 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: datedelta-1.4-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
deltaParses human-readable duration strings like '1…
permissive · top 15,000 on PyPI
tkcalendarProvides Calendar and DateEntry widgets for…
copyleft · top 15,000 on PyPI
datetime-quarterAdds quarter-based date handling to Python's…
permissive · top 15,000 on PyPI
lunardateConverts between Gregorian (solar) and Chinese…
copyleft · top 5,000 on PyPI
fiscalyearProvides fiscal year, quarter, month, and day…
permissive · top 15,000 on PyPI
convertdateConverts dates between the Gregorian calendar…
permissive · top 5,000 on PyPI
epiweeksCalculates epidemiological weeks using US CDC…
permissive · top 15,000 on PyPI
isoweekProvides a Week class representing ISO 8601…
permissive · top 15,000 on PyPI
dateutilsProvides date and time arithmetic operations,…
permissive · top 5,000 on PyPI
workalendarWorkalendar provides holiday calendars and…
permissive · top 5,000 on PyPI