Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Searching also returns full-day events of adjacent days

オープン
#545 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
api

調査の方向性

Start by reproducing the reported cases with the supplied calendar.search(start=..., end=..., event=True, expand=True) calls, then read the implementation and documentation for search() and its handling of full-day events and timezones. Done means searches return the expected events for the reported dates and timezone variants; clarify the intended CalDAV behavior before choosing a fix.

索引モデルが issue の本文から書いたものです。

説明

Problem:

I'm trying to find all events that occur today or later. In some cases, events from yesterday are returned.

I'm not completely sure if this is a bug or just the way CalDAV works, but at least it's not what I expected.

Test setup: There are there are three full-day events in the calendar, on 18.,19.,20.08.25. I created them with Thunderbird, the server is Baikal. I did not specify a timezone (nor could I for full-day events).

Code:

from datetime import datetime, timedelta, date, timezone
import caldav

url = "..."
username = "..."
password = "..."
client = caldav.DAVClient(url, username=username, password=password)
principal = client.principal()
calendars = principal.calendars()
calendar = next(cal for cal in calendars if cal.name == "Test-Cal")

# there are three full-day events in the calendar, on 18.,19.,20.08.25

dates = [
    datetime(year=2025, month=8, day=17, hour=0, minute=10),
    datetime(year=2025, month=8, day=17, hour=0, minute=10, tzinfo=timezone(timedelta(hours=2))),
    datetime(year=2025, month=8, day=17, hour=0, minute=10, tzinfo=timezone(timedelta(hours=0))),
    datetime(year=2025, month=8, day=17, hour=0, minute=0),
    datetime(year=2025, month=8, day=17, hour=0, minute=0, tzinfo=timezone(timedelta(hours=2))),
    datetime(year=2025, month=8, day=17, hour=0, minute=0, tzinfo=timezone(timedelta(hours=0))),
]

for test_time in dates:
    print("Testing with", test_time)
    print("    | 18 | 19 | 20 |")
    for i in range(4):
        print(f" +{i} |", end="")
        t = test_time + timedelta(days=i)
        results = calendar.search(start=t, end=t + timedelta(days=1), event=True, expand=True, sort_keys="dtstart")
        summaries = [e.instance.vevent.summary.value for e in results]
        for j in range(1, 4):
            if f"Test{j}" in summaries:
                print(f" X  |", end="")
            else:
                print(f"    |", end="")
        print()

Output (with comments from me). Expected would be a diagonal in the last three lines.

Testing with 2025-08-17 00:10:00 //my actual code, running in UTC+2 just after midnight
    | 18 | 19 | 20 |
 +0 |    |    |    |
 +1 | X  |    |    |
 +2 | X  | X  |    | //the bug I noticed
 +3 |    | X  | X  |
Testing with 2025-08-17 00:10:00+02:00 //add the timezone explicitly
    | 18 | 19 | 20 |
 +0 |    |    |    |
 +1 | X  |    |    |
 +2 | X  | X  |    | //no change
 +3 |    | X  | X  |
Testing with 2025-08-17 00:10:00+00:00 //now in UTC
    | 18 | 19 | 20 |
 +0 | X  |    |    | //this is correct b/c 00:10+1d contains the next day!
 +1 | X  | X  |    |
 +2 |    | X  | X  |
 +3 |    |    | X  |
Testing with 2025-08-17 00:00:00 // test on exactly midnight
    | 18 | 19 | 20 |
 +0 |    |    |    |
 +1 | X  |    |    |
 +2 | X  | X  |    | //same problem
 +3 |    | X  | X  |
Testing with 2025-08-17 00:00:00+02:00
    | 18 | 19 | 20 |
 +0 |    |    |    |
 +1 | X  |    |    |
 +2 | X  | X  |    | //dito
 +3 |    | X  | X  |
Testing with 2025-08-17 00:00:00+00:00 //midnight, UTC
    | 18 | 19 | 20 |
 +0 |    |    |    |
 +1 | X  |    |    | //correct!
 +2 |    | X  |    |
 +3 |    |    | X  |

This is the pattern I could make up from this:

  • without timezone infos, the datetime gets interpreted in the local timezone
  • before matching against full-day events in the calendar, dates are shifted to UTC
  • this causes the dates to move to the previous day

This is just my guesswork, someone with more insight to CalDAV can probably make more sense out of this.

主要言語
Python
スター
412
フォーク
113
平均マージ
1日 6時間
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-caldav/caldav のほかの issue

python-caldav/caldav の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。