skillfed

datedelta

Like datetime.timedelta, for date arithmetic.

datedelta v1.4 145.3K downloads/30d#11,131 on PyPI147
Permissive license BSD-3-Clause AGING released

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 datedelta

uv

uv add datedelta

poetry

poetry add datedelta

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

date arithmetic librarycalendar-aware timedeltaadd months to dategregorian calendar mathsubscription period calculationleap year date handlingmonth and year arithmetic
date-arithmeticcalendar-math

More Software Development packages