--- id: prefixdate version: "0.6.1" license: MIT license_treatment: permissive maintenance: active --- # prefixdate — Parse and process date string of varied precision as prefixes in Python. License: permissive · Maintenance: active · Downloads: 914.0K/mo ## What it is and what it does Prefixdate is a lightweight date parser for handling dates where only partial information is known—a year alone, a year and month, or a full date. It normalizes these partial dates into a consistent format and tracks the precision level (year, month, day, or finer) so your application knows what was actually specified. The library accepts strings in ISO 8601-like format (e.g., '2001', '2001-4', '2001-04-02'), integers, datetime objects, or custom format strings via strptime patterns, and returns a structured DatePrefix object with both the normalized text representation and precision metadata. The package is designed for contexts where sources report dates with varying completeness—common in historical records, metadata, or user-supplied information. It does not implement the full complexity of ISO 8601 or RFC 3339 (no date ranges, no week notation), focusing instead on the practical case of partial dates. It has no external dependencies and runs on Python 3.11 and newer. Use it for: - Normalize dates from historical datasets where only year or year-month is known, preserving precision information. - Parse user-supplied dates in custom formats and standardize them to ISO 8601-like strings for storage. - Validate and re-format partial dates in metadata systems that track date confidence. - Handle datetime objects with custom precision truncation (e.g., round to minute or hour level). - Accept dates in multiple formats and produce consistent normalized output. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses date strings with partial precision (year, month, or day) into a structured format, normalizing and validating them for use in applications that handle incomplete date information. Yes. Prefixdate solves a specific, real problem—handling dates with incomplete precision—cleanly and with zero dependencies. It is actively maintained, licensed permissively, supports current Python versions, and has no known vulnerabilities. Install it if your application needs to parse or normalize dates where only partial information is available; skip it if you only work with complete dates. ## Install pip install prefixdate uv add prefixdate poetry add prefixdate ## Installing prefixdate Before you install: Installs cleanly with no runtime dependencies. Actively maintained with a recent release; last commit was 2026-08-08 and the project is not archived. License in practice: MIT license permits use, modification, and distribution with minimal restrictions, making it suitable for both open and proprietary projects. Quickstart: pip install prefixdate from prefixdate import parse, normalize_date, Precision date = parse('2001-3') print(date.text) # '2001-03' print(date.precision) # Precision.MONTH normalized = normalize_date('2001-1') print(normalized) # '2001-01' Requires Python 3.11 or newer. Verify before relying: - Whether the library handles leap-year edge cases or other calendar complexities beyond what the caveats mention. - Performance characteristics when parsing large batches of dates or with many custom format strings. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 914.0K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags partial date parsing, incomplete date handling, date precision normalization, iso8601 prefix dates, flexible date parser, year-month-day parsing, date-parsing, data-normalization [View on SkillFed](https://skillfed.io/packages/prefixdate) · [View on PyPI](https://pypi.org/project/prefixdate/)