Skip to content

Issue 243 #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: debug-statements

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.11.9
hooks:
- id: ruff
args: [--config, "pyproject.toml", --fix]
Expand Down
4 changes: 3 additions & 1 deletion recurring_ical_events/adapters/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def as_component(
for subcomponent in self._component.subcomponents:
copied_component.add_component(subcomponent)
if "RECURRENCE-ID" not in copied_component:
copied_component["RECURRENCE-ID"] = copied_component["DTSTART"]
copied_component["RECURRENCE-ID"] = vDDDTypes(
copied_component["DTSTART"].dt
)
return copied_component

@cached_property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN:VCALENDAR
BEGIN:VEVENT
SUMMARY:daily testing
DTSTART:20150901T080000
DTEND:20150901T100000
DTSTAMP:20250529T181439Z
UID:test1
RRULE:FREQ=DAILY
END:VEVENT
END:VCALENDAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""The RECURRENCE-ID should not be identical to DTSTART.

That is confusing.
See https://github.com/niccokunzmann/python-recurring-ical-events/issues/243
"""

from datetime import datetime


def test_recurrence_id_is_not_identical_to_dtstart(calendars):
"""We need to make sure they are distinct to set the values independently."""
start = datetime(2015,9,1)
end = datetime(2015,9,4)
recurrings = calendars.issue_243_recurrence_id_is_not_identical_to_dtstart.between(start, end)
r = recurrings[0]

## This break, it should pass
assert id(r["dtstart"]) != id(r["recurrence-id"])
assert r["dtstart"] is not r["recurrence-id"]

## This is true
assert r["recurrence-id"].dt == datetime(2015,9,1,8)

## The test recurrence at this particlar day should start at 9, not at 8
r["dtstart"].dt = datetime(2015,9,1,9)

## This should not break, but breaks
assert r["recurrence-id"].dt == datetime(2015,9,1,8)

r["dtstart"] = datetime(2015,9,1,9)

## This should not break, but breaks
assert r["recurrence-id"].dt == datetime(2015,9,1,8)