Skip to content

rrule parsing allows UNTIL with non-UTC dates #633

@ryanpetrello

Description

@ryanpetrello
~ cat utc_until.py && python utc_until.py
from datetime import datetime
import dateutil.rrule

rrule = dateutil.rrule.rrulestr(
    'DTSTART;TZID=America/New_York:20180601T120000 RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20180602T000000'
)
print rrule.after(datetime.utcnow())
Traceback (most recent call last):
  File "utc_until.py", line 7, in <module>
    print rrule.after(datetime.utcnow())
  File "/home/ryan/.local/share/virtualenvs/tmp.jQo0RUu68U-Zv6c7Bw0/lib/python2.7/site-packages/dateutil/rrule.py", line 223, in after
    for i in gen:
  File "/home/ryan/.local/share/virtualenvs/tmp.jQo0RUu68U-Zv6c7Bw0/lib/python2.7/site-packages/dateutil/rrule.py", line 862, in _iter
    if until and res > until:
TypeError: can't compare offset-naive and offset-aware datetimes

According to RFC5545 Section 3.3.10:
https://tools.ietf.org/html/rfc5545#section-3.3.10

If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions