--- id: datetimerange version: "2.3.2" license: MIT License license_treatment: permissive maintenance: active --- # DateTimeRange — DateTimeRange is a Python library to handle a time range. e.g. check whether a time is within the time range, get the intersection of time ranges, truncate a time range, iterate through a time range, and so forth. License: permissive · Maintenance: active · Downloads: 331.9K/mo ## What it is and what it does DateTimeRange is a Python library for creating and working with time intervals. It wraps datetime objects into range containers that support standard operations—checking whether a specific time falls within a range, finding overlaps between ranges, computing their union or intersection, and iterating through a range at regular intervals. The library handles timezone-aware datetimes and daylight saving time transitions. You use it when you need to reason about time spans rather than individual moments: scheduling systems that check availability windows, log analysis that filters events within time bounds, or data pipelines that need to split time series into regular chunks. It depends on python-dateutil for relative date arithmetic and typepy for type validation. Use it for: - Check if a specific timestamp falls within a scheduled maintenance window or business hours range. - Find overlapping time slots when merging calendar events or meeting availability. - Iterate through a date range in monthly or quarterly steps for reporting or data aggregation. - Truncate or split time ranges to align with reporting periods or data collection windows. - Compute the intersection of multiple time ranges to find common availability across resources. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. DateTimeRange creates and manipulates time range objects, supporting operations like containment checks, intersections, unions, truncation, and iteration over intervals. Yes. DateTimeRange is actively maintained, has no known vulnerabilities, minimal dependencies, and solves a concrete problem in datetime handling that the standard library handles awkwardly. Install it if your code frequently reasons about time intervals, overlaps, or iteration across date ranges. ## Install pip install datetimerange uv add datetimerange poetry add datetimerange ## Installing DateTimeRange Before you install: Low install friction with just two runtime dependencies (python-dateutil and typepy). Actively maintained with a recent commit on 2026-07-20 and stable production status. License in practice: MIT License permits commercial and private use with minimal restrictions, making it suitable for most projects without licensing concerns. Quickstart: pip install DateTimeRange from datetimerange import DateTimeRange time_range = DateTimeRange("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900") print("2015-03-22T10:05:00+0900" in time_range) Requires Python 3.9 or later. ## Package facts - License: MIT License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 331.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags time range operations, datetime interval handling, check if time in range, datetime intersection, iterate time ranges, timezone-aware time spans, time range truncate split, datetime-utilities, time-interval-logic [View on SkillFed](https://skillfed.io/packages/datetimerange) · [View on PyPI](https://pypi.org/project/datetimerange/)