pimutils / pimutils/khal

Importing a ICS file with an event which rescheduled within one day creates two events at the day

Open
#1,434 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
233
Avg merge
1h 44m
Merged PRs (30d)
1

Description

Describe the bug
I have an event which happens every day at 11:40. I've run into a problem with rescheduling the event within a day. In the following example, I moved the event from 11:40 to 14:40. However, khal shows the old and the new event at the day.

If applicable: Stack Trace
It does not crash.

To Reproduce

  1. Save the following output to /tmp/khaltest/private/8af16f25-ee94-40cb-985d-591e2f3c8f87.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:DAVx5/4.5.3-ose ical4j/3.2.19
BEGIN:VTIMEZONE
TZID:Europe/Dublin
BEGIN:STANDARD
DTSTART:19961027T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
TZNAME:GMT
TZOFFSETFROM:+0100
TZOFFSETTO:+0000
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19810329T010000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
TZNAME:IST
TZOFFSETFROM:+0000
TZOFFSETTO:+0100
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:8af16f25-ee94-40cb-985d-591e2f3c8f87
DTSTART;TZID=Europe/Dublin:20250909T114000
DTEND;TZID=Europe/Dublin:20250909T120000
DTSTAMP:20250916T144605Z
EXDATE;TZID=Europe/Dublin:20250913T114000,20250909T114000
RRULE:FREQ=DAILY;INTERVAL=1
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:Desayuno
END:VEVENT
BEGIN:VEVENT
UID:8af16f25-ee94-40cb-985d-591e2f3c8f87
RECURRENCE-ID;TZID=Europe/Dublin:20250916T144000
DTSTART;TZID=Europe/Dublin:20250916T144000
DTEND;TZID=Europe/Dublin:20250916T150000
DESCRIPTION:
DTSTAMP:20250916T144605Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Desayuno
END:VEVENT
END:VCALENDAR
  1. Create configuration for khal with the following content at /tmp/khaltest/config:
[calendars]

[[private]]
path = /tmp/khaltest/private

type = calendar

[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M

[default]
default_calendar = private

[sqlite]
path = /tmp/khaltest/khal.db
  1. Run khal --config /tmp/khaltest/config list 2025-09-16 2025-09-16
  2. See the output
Today, 2025-09-16
11:40-12:00 Desayuno ⟳
14:40-15:00 Desayuno ⟳

Expected behavior
The output has to be

Today, 2025-09-16
14:40-15:00 Desayuno ⟳

Screenshots
If applicable, add screenshots to help explain your problem.

OS, version, khal version and how you installed it:

  • The output of khal --version: khal, version 0.11.3.dev250+g37d9c64db
  • Installation method: khal has been cloned from https://github.com/pimutils/khal.git, and installed via pip install -e .
  • python version: 3.13.7
  • OS: Fedora 41
  • Your khal config file: see the content of the configuration file at the step 2 from the section To Reproduce.
  • The versions of your other python packages:
aiohappyeyeballs==2.6.1
aiohttp==3.12.15
aiosignal==1.4.0
aiostream==0.7.0
attrs==25.3.0
certifi==2025.8.3
charset-normalizer==3.4.3
click==8.2.1
click-log==0.4.0
configobj==5.0.9
freezegun==1.5.5
frozenlist==1.7.0
hypothesis==6.138.17
icalendar==6.3.1
idna==3.10
iniconfig==2.1.0
-e git+https://github.com/pimutils/khal@37d9c64db1b13831327af4b64172d4dfcc9c6998#egg=khal
multidict==6.6.4
packaging==25.0
pluggy==1.6.0
propcache==0.3.2
Pygments==2.19.2
pytest==8.4.2
python-dateutil==2.9.0.post0
pytz==2025.2
pyxdg==0.28
requests==2.32.5
six==1.17.0
sortedcontainers==2.4.0
typing_extensions==4.15.0
tzdata==2025.2
tzlocal==5.3.1
urllib3==2.5.0
urwid==3.0.2
vdirsyncer==0.20.0
wcwidth==0.2.13
yarl==1.20.1

Additional context
I actually tried to fix on my own. However, my ICS file doesn't seem aligning the specification.

The DATE-TIME value is set to the time when the original recurrence instance would occur; meaning that if the intent is to change a Friday meeting to Thursday, the DATE-TIME is still set to the original Friday meeting.

In my example the DATE-TIME value of the property RECURRENCE-ID is set to the new value. Do I have an invalid "ics"? If it's valid, do you have an idea how can I identify the event which has to be amended?

Amazing project, BTW.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied ICS and khal --config /tmp/khaltest/config list 2025-09-16 2025-09-16, then trace how imported recurrence exceptions and RECURRENCE-ID values are matched. Check the linked RFC semantics and existing recurrence handling before deciding the expected behavior. Done means the moved event appears once at 14:40 and the case is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.