Skip to content

Fix plistlib loading of partial ISO 8601 dates#4

Open
JavaZeroo wants to merge 3 commits into
mainfrom
fix/plistlib-partial-date
Open

Fix plistlib loading of partial ISO 8601 dates#4
JavaZeroo wants to merge 3 commits into
mainfrom
fix/plistlib-partial-date

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

Summary:

  • Fix plistlib._date_from_string raising a confusing TypeError when a <date> omits smaller units (e.g. 2024-06Z or 2024Z). The date regex makes month/day/time optional, but the argument list for datetime.datetime() was truncated at the first missing component. Missing components now default to the start of the period.

  • Add coverage for loading partial dates (year only, year-month, etc.).

Tests:

  • ./python -m test test_plistlib

@JavaZeroo JavaZeroo force-pushed the fix/plistlib-partial-date branch from b6ad3b9 to c2c8258 Compare June 10, 2026 06:43
plistlib's date regex makes the month, day and time components optional,
but _date_from_string stopped building the datetime arguments at the
first missing component, so a partial date such as ``2024-06Z`` raised a
confusing TypeError instead of producing a datetime. Default the omitted
components to the start of the period.
@JavaZeroo JavaZeroo force-pushed the fix/plistlib-partial-date branch from c2c8258 to 526bbb5 Compare June 10, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant