Skip to content

fix: include RDATE in busy calculation - #691

Open
SebastianKrupinski wants to merge 2 commits into
sabre-io:masterfrom
SebastianKrupinski:fix-include-rdate-in-busy-calulation
Open

SebastianKrupinski wants to merge 2 commits into
sabre-io:masterfrom
SebastianKrupinski:fix-include-rdate-in-busy-calulation

Conversation

@SebastianKrupinski

@SebastianKrupinski SebastianKrupinski commented Oct 1, 2024 •

Copy link
Copy Markdown
Contributor

fix: include RDATE in busy calculation

ICal spec allows for events with only an RDATE. At the moment if an event only includes an RDATE and no RRULE it is skipped due to the current code path only checking for the existence of a RRULE.

RFC Reference https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.5.2

@SebastianKrupinski SebastianKrupinski changed the title fix: include RDATE in busy calulation fix: include RDATE in busy calculation Oct 1, 2024
@codecov

codecov Bot commented Oct 14, 2024 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.76%. Comparing base (48f48cf) to head (7081a17).
⚠️ Report is 48 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #691      +/-   ##
============================================
- Coverage     98.76%   98.76%   -0.01%     
  Complexity     1876     1876              
============================================
  Files            71       71              
  Lines          5346     5344       -2     
============================================
- Hits           5280     5278       -2     
  Misses           66       66              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@phil-davis

Copy link
Copy Markdown
Contributor

@SebastianKrupinski can you add some unit test case(s) that demonstrate that RDATE specifications will now be correctly processed.

@ndo84bw

ndo84bw commented Nov 2, 2026

Copy link
Copy Markdown

I tested the code and it did what I expected.

@SebastianKrupinski I can offer the missing test. I would put it here: https://github.com/sabre-io/vobject/blob/5e2f3388/tests/VObject/FreeBusyGeneratorTest.php#L389. I can't test RDATE together with RRULE here, because that only gets fixed by #716.

    public function testRecurrenceDate(): void
    {
        // RDATE without RRULE, all dates show up
        $blob = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foobar-rdate
DTSTART:20101231T120000Z
DTEND:20101231T130000Z
RDATE:20110101T120000Z,20110102T120000Z
END:VEVENT
END:VCALENDAR
ICS;

        self::assertFreeBusyReport(
            "FREEBUSY:20110101T120000Z/20110101T130000Z\n".
            "FREEBUSY:20110102T120000Z/20110102T130000Z\n",
            $blob
        );
    }

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski
SebastianKrupinski force-pushed the fix-include-rdate-in-busy-calulation branch from 32416e3 to 0ac6d7b Compare November 2, 2026 15:49
@SebastianKrupinski

Copy link
Copy Markdown
Contributor Author

@phil-davis done

Test What it shows
testRecurrenceDate The event's own start time is before the report window, but its RDATE instances inside the window show as busy. One that falls after the window is left out.
testRecurrenceDateDuration RDATE instances get their length from DURATION rather than DTEND.
testRecurrenceDateMultipleProperties Dates from several separate RDATE lines are all picked up.
testRecurrenceDateWithExceptionDate An EXDATE removes a matching RDATE instance.
testRecurrenceDateOutsideTimeRange RDATE instances all outside the window produce nothing. It passes before and after the fix and is there to guard against regressions.

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>

@ndo84bw ndo84bw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look good, 4 of 5 fail without the fix

@ndo84bw

ndo84bw commented Nov 2, 2026

Copy link
Copy Markdown

@SebastianKrupinski Claude 🤖 pointed out that renaming the timezone names in the tests won't help here, because testTimeZoneBCIdentifiers deliberately tests the old timezone names, so we can't rename those. In my opinion, we should follow the tables that already exist (

$this->map = array_merge(
include __DIR__.'/../timezonedata/windowszones.php',
include __DIR__.'/../timezonedata/lotuszones.php',
include __DIR__.'/../timezonedata/exchangezones.php',
include __DIR__.'/../timezonedata/php-workaround.php'
);
) and add a new file like tzdata-backward.php. The list could be generated from the backward file of the IANA tz database (https://github.com/eggert/tz/blob/main/backward). What do you think, are you already working on this? Should I open a PR for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants