Skip to content

function to_dateutil_rruleset() include the dtend in returned array #232

@LucasGrugru

Description

@LucasGrugru

Hello,

I noticed a behavior that I don't understand. This may be a desired behavior but it brings unwanted data.

the function to_dateutil_rruleset(self, dtstart=None, dtend=None, cache=False) with a dtend always returns the end date, even if the latter is not part of the recurrence rule.
The problem is located on file base.py:571

        if dtend is not None:
            rruleset.rdate(dtend)

the test for this part of code is just as mysterious (test_occurrences.py:160):

    assert occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
        datetime(2014, 1, 3, 0, 0, 0),
        # We always get dtend, for reasons that aren't entirely clear
        datetime(2014, 1, 5, 0, 0, 0),
    ]

The problem occurred when we want to retrieve or counting occurences between two date or after a date.
For the function between(self, after, before, inc=False, dtstart=None, dtend=None, cache=False) for example, the before parameter is passed to to_dateutil_rruleset as dtend parameter, and the returned array has not the good value.

I think, we can add paramter to to_dateutil_rruleset for not adding the dtend when we call function from before, after, between, count.

Maybe there's something I just don't understand?
Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions