python-dateutil
Powerful extensions to Python's datetime module — flexible date parsing, relative deltas, timezone support, and iCal recurrence rules. python-dateutil features: parser.parse() for flexible string-to-datetime parsing, relativedelta for calendar-aware date arithmetic (months, years, weekdays), rrule for RFC 5545 recurrence rules (WEEKLY, MONTHLY, BYDAY, UNTIL, COUNT), tzlocal for local timezone, tzutc for UTC, tzoffset for fixed offsets, tz.gettz() for IANA timezone lookup, Easter calculation, and dateutil.easter for ecclesiastical calendar.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Pure datetime library. ReDoS vulnerability risk for parser.parse() with adversarial input — validate and length-limit user-provided date strings. Parsing user-provided dates: use try/except ParserError; set maximum string length before parsing. IANA timezone data uses system tzdata — keep system timezone database updated.
⚡ Reliability
Best When
Flexible date string parsing from arbitrary sources and iCal recurrence rule generation — dateutil is the reference implementation for these use cases.
Avoid When
Projects using arrow or pendulum (built-in TZ support), Python 3.9+ with zoneinfo for timezone only, or bulk date operations (use pandas).
Use Cases
- • Agent flexible date parsing — from dateutil import parser; dt = parser.parse('January 15, 2024'); dt2 = parser.parse('15 Jan 2024 14:30'); dt3 = parser.parse('Mon, 15 Jan 2024 14:30:00 +0000') — parsing; agent parses dates from diverse text sources; parser.parse() handles hundreds of formats automatically; for ambiguous formats: dayfirst=True or yearfirst=True
- • Agent relative delta — from dateutil.relativedelta import relativedelta; from datetime import date; today = date.today(); next_month = today + relativedelta(months=1); last_year = today - relativedelta(years=1); age = relativedelta(today, birthdate).years — calendar math; agent computes calendar-aware date differences; months adds calendar months (not 30 days)
- • Agent recurrence rules — from dateutil.rrule import rrule, WEEKLY, MO, FR; rule = rrule(WEEKLY, byweekday=[MO, FR], count=10, dtstart=datetime(2024, 1, 1)); dates = list(rule) — rrule; agent generates recurring dates (every Monday and Friday, next 10 occurrences); RFC 5545 compliant; used for calendar events
- • Agent local timezone — from dateutil.tz import tzlocal, tzutc, gettz; local_tz = tzlocal(); utc = tzutc(); eastern = gettz('America/New_York'); aware_dt = datetime.now(local_tz) — timezone; agent gets local timezone without pytz; gettz() uses IANA names; works as tzinfo parameter in datetime()
- • Agent parse with timezone — from dateutil import parser; dt = parser.parse('2024-01-15 14:30:00 EST'); dt_utc = parser.parse('2024-01-15T14:30:00Z'); dt_offset = parser.parse('2024-01-15 14:30:00+05:30') — timezone-aware parsing; agent parses strings with timezone information; timezone abbreviations parsed to fixed offsets
Not For
- • Arrow/pendulum users — both libraries include similar functionality with better APIs
- • Simple datetime operations — stdlib datetime + zoneinfo covers basic needs in Python 3.9+
- • High-performance bulk date processing — dateutil is pure Python; for bulk use pandas Timestamp
Interface
Authentication
No auth — datetime utility library.
Pricing
python-dateutil is Apache 2.0/BSD licensed. Dependency of many libraries (pandas, arrow). Free for all use.
Agent Metadata
Known Gotchas
- ⚠ parser.parse() is vulnerable to ReDoS on adversarial input — dateutil parser uses regex matching; some complex date strings cause excessive backtracking; agent code parsing untrusted user input: validate string length and format before parsing; or use strict format: datetime.strptime(s, '%Y-%m-%d') which is faster and safe
- ⚠ Ambiguous dates use US convention by default — parser.parse('01/02/2024') — January 2nd (MDY); European convention: parser.parse('01/02/2024', dayfirst=True) — February 1st; agent code: always specify dayfirst=True for European dates or yearfirst=True for ISO; use ISO 8601 format when possible to avoid ambiguity
- ⚠ relativedelta months adds calendar months not 30 days — date(2024,1,31) + relativedelta(months=1) = date(2024,2,29) (leap year) or date(2024,2,28); different from timedelta(days=30); agent code expecting fixed month lengths: use timedelta(days=30); for calendar month arithmetic: use relativedelta
- ⚠ tzlocal returns local system timezone — from dateutil.tz import tzlocal; datetime.now(tzlocal()) uses system TZ; on servers this may be UTC; agent code in production: explicitly set timezone rather than relying on system TZ; tzlocal is good for dev tools, not reliable for production
- ⚠ rrule COUNT vs UNTIL — rrule(WEEKLY, count=10) generates 10 occurrences; rrule(WEEKLY, until=datetime(2024,12,31)) generates until date; agent code: either count or until, not both; without either, rrule generates infinite sequence — must call list() carefully or use islice(); infinite rrule + list() hangs
- ⚠ parser.parse() returns naive datetime for timezone-free strings — parser.parse('2024-01-15') returns naive datetime; parser.parse('2024-01-15 14:30:00+00:00') returns aware datetime; agent code mixing naive and aware: TypeError on comparison; ensure consistency: pass tzinfos= parameter for abbreviation mapping: tzinfos={'EST': -5*3600}
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for python-dateutil.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-06.