Skip to content

Default DTSTART in rrule lacks a timezone #652

@href

Description

@href

Since 2.7, the following code fails in our project:

rule = rrule.rrulestr("RRULE:FREQ=WEEKLY;WKST=MO;BYDAY=MO,TU;UNTIL=20180331T200000Z")

This is the error we see:

ValueError: RRULE UNTIL values must be specified in UTC when DTSTART is timezone-aware

The comment around the exception mentions this:

# 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.

We however do not specify the DTSTART property. Dateutil defaults to the current date in this case. However, said default does not have a timezone. Because we do however pass a timezone with our UNTIL property, we run into this exception.

Now I think you can make the argument that this is really our problem and it's probably best anyway to be specific with the DTSTART property (which is how we're going to work around this problem). However, I think it might also make sense to apply the timezone of the UNTIL property when the DTSTART date is created by dateutil.

This is related to #620 and #634.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions