Skip to content

preserve explicit calendar alarm timezones - #67239

Draft
yezhengli-Mr9 wants to merge 2 commits into
nextcloud:masterfrom
yezhengli-Mr9:fix/calendar-reminder
Draft

yezhengli-Mr9 wants to merge 2 commits into
nextcloud:masterfrom
yezhengli-Mr9:fix/calendar-reminder

Conversation

@yezhengli-Mr9

@yezhengli-Mr9 yezhengli-Mr9 commented Nov 30, 2026 •

Copy link
Copy Markdown

Review overview

Preserve explicit UTC calendar alarm timestamps while retaining the existing fallback for floating/unresolved timezones.

Area Change / compatibility
UTC distinction Inspect stored dates for Z, UTC and Etc/UTC rather than treating every UTC result from expansion as explicit UTC.
Scheduling Preserve absolute triggers and reuse resolved timestamps when filtering/storing master, exception and recurring reminders.
Human review Twelve additional parameterized cases cover custom/unresolved zones, mixed dates, expiry and recurrence.

Validation and evidence

Check / environment Recorded result / boundary
Ubuntu 24.04 / PHP 8.3 Full reminder directory: 82 tests, 743 assertions; syntax and PHP CS Fixer passed.
Static analysis Full repository Psalm passed on PHP 8.3.37 without substantive baseline changes.
Live CalDAV/database Four UTC cases corrected from +39,600 seconds to zero offset; ten Pago_Pago and twelve Helsinki cases checked.
Review regressions Individual filter reversions cause failures; contributor confirmed personal review and live-instance testing.
Review boundary Detail
Limitations / follow-up No general custom-VTIMEZONE parser or guarantee for unresolved event zones differing from calendar zones. Recorded upstream workflows awaited maintainer approval; local results are not upstream CI success.
Evidence status Summarized from the existing PR record; no new tests or benchmarks were run for this description-only update. Detailed commands, provenance, checklists, disclosures, and caveats are preserved below.

Related issues, work items, and PRs

Reference Type Relationship / scope
nextcloud/server#43113 Issue Related timezone discussion; broader cases are not claimed resolved.
nextcloud/server#39640 Issue Related timezone discussion; scope remains explicit alarm timezone handling.
nextcloud/server#36192 PullRequest Related timezone discussion; not an automatic-closing claim.
nextcloud/server#50867 PullRequest Reminder-recipient selection is explicitly outside this trigger-timezone change.
Public issue / work item Tracking status Existing reviewer-request links, pinned source references, DCO and required AI disclosure are retained below. No separate public work-item link was verified.
Original detailed description, reproduction, and repository checklist
  • Resolves: incorrect timezone conversion for explicitly UTC calendar alarms; no issue closure claimed.

Summary

UTC is an explicit timezone, not an indication that an event is floating. Reminder scheduling currently reinterprets UTC alarm timestamps in the calendar timezone. In a Pacific/Pago_Pago calendar this delays an alarm by eleven hours.

Keep the calendar-timezone fallback when Sabre returns UTC for floating or unresolved timezones, but skip it when the stored source date explicitly specifies UTC (Z, UTC or Etc/UTC). Inspect the stored event because recurrence expansion can rewrite an unresolved TZID as UTC. Preserve absolute trigger timestamps and reuse the resolved timestamp for filtering and storing reminders.

Validation

  • Ubuntu 24.04 Docker, PHP 8.3.6: the full CalDAV Reminder unit-test directory passes with 82 tests and 743 assertions.
  • Both changed files pass PHP syntax checks and the repository's PHP CS Fixer configuration.
  • Full repository Psalm analysis passes on PHP 8.3.37 with no errors and no substantive baseline changes.
  • Live authenticated CalDAV MKCALENDAR/PUT requests and reminder database checks reproduce a +39,600-second offset on unchanged upstream for UTC start, UTC end, UTC duration and absolute UTC alarms. All four have zero offset with this fix.
  • Live CalDAV checks pass for ten cases in Pacific/Pago_Pago and twelve in Europe/Helsinki, including an embedded customized VTIMEZONE, an unresolved TZID, and the reported Outlook/legacy names in the Helsinki calendar. Floating/all-day controls and unresolved-timezone fallback match unchanged upstream behavior.
  • Tests cover mixed floating/UTC RELATED=END dates, expired alarms in the master and exception loops, and subsequent recurring occurrences. Mutation experiments confirm that reverting each scheduling filter makes a regression test fail.
  • The contributor confirms personal review and live-instance testing of the revision.

Tests added in response to human review

Follow-up commit 393ca22 adds 12 parameterized unit-test cases to the original PR: ten creation/expiry cases and two recurring-reminder cases. The full reminder suite increased from 70 tests / 641 assertions to 82 tests / 743 assertions. These are local results, not a claim that upstream CI has passed.

Requests: DerDreschner's review and SebastianKrupinski's embedded-timezone example. The committed cases are in ReminderServiceTest.php, under provideAlarmTimeZones() and provideRecurringAlarmTimeZones().

Human feedback / requirement Newly added coverage Verified expectation / limits Source permalinks
DerDreschner: preserve fallback for Outlook FLE Standard Time FLE Standard Time creation case in a Europe/Helsinki calendar 09:00 event with a one-hour advance alarm queues at 06:00Z, not 08:00Z. Also checked through live CalDAV. Test cases; fallback fix
DerDreschner: preserve fallback for Europe/Kiev Europe/Kiev creation case in Europe/Helsinki Same 06:00Z expectation; also checked through live CalDAV. Ubuntu validation requires tzdata-legacy. Test cases; fallback fix
Both reviewers: handle an embedded Customized Time Zone VTIMEZONE Customized Time Zone creation case uses the supplied STANDARD/DAYLIGHT definition; custom timezone recurring case exercises later scheduling Creation expects 06:00Z in Helsinki. The recurrence case preserves the existing calendar fallback in Pago_Pago. Also live-tested. The unit fixture uses February 2023 rather than the comment's February 2027; no separate summer/DST-transition case was added. VTIMEZONE fixture; creation cases; recurring cases; fix
DerDreschner: inspect stored dates, not dates rewritten by recurrence expansion unresolved timezone and custom timezone recurring cases; a deterministic Unresolvable Time Zone creation case Initial and subsequent reminders preserve calendar fallback even when expansion rewrites the timezone to UTC. Separate recurring cases for every Windows/legacy alias were not added. Recurring cases; creation cases; stored-date check; next-occurrence call
DerDreschner: RELATED=END with mixed floating/zoned dates UTC start floating end and floating start UTC end A floating DTEND uses calendar fallback (20:00Z); a UTC DTEND stays UTC (09:00Z). Coverage uses UTC as the zoned side; a separate mixed floating/non-UTC pair was not added. Mixed-date tests; DTEND selection
DerDreschner: expired alarms in the master loop expired floating master in Europe/Helsinki No reminder is inserted when the correctly converted alarm is already past. The original expired UTC alarm case is retained, not newly added. New master case; existing UTC case; no-insert assertion; master filter
DerDreschner: expired alarms in exceptions expired floating exception and expired UTC exception Both assert that no reminder is inserted. Exception cases; no-insert assertion; exception filter
SebastianKrupinski: exempt only stored explicit UTC (Z, UTC, Etc/UTC) New Etc/UTC TZID case Expects 08:00Z without calendar conversion. UTC start (Z) and UTC TZID already existed and remain covered; they are not counted as new cases. UTC marker tests; explicit-UTC check and fallback
DerDreschner: reverting the filtering changes must fail tests Separate local mutation experiments reverted the exception, master, and next-occurrence filtering paths individually Each mutation caused a regression assertion to fail, then the source was restored. This was an experiment; no permanent mutation-testing tool or CI job was added. Exercised source: exception filter, master filter, next-occurrence filter. These links identify the tested code, not a committed mutation harness.

All source links are pinned to the reviewed commit:

Scope: this restores the existing unresolved/custom-timezone fallback; it does not implement general custom-VTIMEZONE parsing or guarantee correct interpretation when the event's unresolved timezone differs from the calendar's timezone. The table distinguishes committed tests from live checks and mutation experiments.

To reproduce, create a calendar with timezone Pacific/Pago_Pago and a future event with an explicitly UTC DTSTART and a relative alarm. A 09:00Z event with a one-hour advance alarm must queue a reminder for 08:00Z, not 19:00Z. Repeat with RELATED=END and DTEND or DURATION, and with an absolute UTC trigger.

Unit tests:

php -d memory_limit=512M lib/composer/bin/phpunit --fail-on-warning --fail-on-risky -c tests/phpunit-autotest.xml apps/dav/tests/unit/CalDAV/Reminder

Related timezone discussions: #43113, #39640 and #36192. This patch does not claim to resolve every case in those discussions. #50867 concerns reminder-recipient selection rather than trigger timezone calculation and is outside this change.

TODO

  • Maintainer review and upstream CI.

Current published revision: 393ca22b788830701b2d41717a995e8f06aced89. DCO has passed. All 26 Actions workflows currently report action_required before any jobs run, awaiting upstream maintainer approval; the new upstream pipelines have not passed yet. Relevant runs: PHPUnit and Psalm.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Copilot SDK in VS Code, using model gpt-6.1-sol, assisted with the implementation, tests, Docker experiments and PR text. Each assisted commit includes the required Assisted-by: Copilot:gpt-6.1-sol trailer.

Explicit UTC alarm timestamps were being reinterpreted in the calendar timezone, delaying reminders by eleven hours in Pacific/Pago_Pago. Restrict the calendar-timezone fallback to floating dates and keep recurrence filtering consistent with stored reminder times.

Assisted-by: Copilot:gpt-6.1-sol
Signed-off-by: Yezheng Li <liyezheng@microsoft.com>
@yezhengli-Mr9 yezhengli-Mr9 changed the title fix(dav): preserve explicit calendar alarm timezones preserve explicit calendar alarm timezones Nov 30, 2026
@yezhengli-Mr9
yezhengli-Mr9 marked this pull request as ready for review November 30, 2026 19:26
@DerDreschner

Copy link
Copy Markdown
Member

/backport to stable35

@DerDreschner

Copy link
Copy Markdown
Member

/backport to stable34

@DerDreschner

Copy link
Copy Markdown
Member

/backport to stable33

@DerDreschner DerDreschner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. One blocker: timezones that Sabre can't resolve (e.g. Outlook's FLE Standard Time, Europe/Kiev, Customized Time Zone) end up as UTC but aren't floating, so they no longer get the calendar timezone. A 09:00 FLE Standard Time event with -PT1H in a Europe/Helsinki calendar is due at 08:00Z instead of 06:00Z (correct on master). getEventObject() also rewrites the date, so please decide on the stored event: keep the UTC check and skip the conversion only if the stored date is explicitly UTC.

Please also add tests for these timezones, RELATED=END with mixed floating/zoned dates, and expired alarms in the master loop and in exceptions. Reverting those lines currently keeps all tests green.

Assisted by ClaudeCode:claude-opus-5-5

@SebastianKrupinski

Copy link
Copy Markdown
Contributor

Adding to the review above: unresolvable timezones aren't limited to Outlook's Windows names. They also include custom timezones that are valid under RFC 5545, i.e. a TZID defined by an embedded VTIMEZONE.

For example, this event in a Europe/Helsinki calendar is due at 06:00Z on master and at 08:00Z with this PR:

BEGIN:VTIMEZONE
TZID:Customized Time Zone
BEGIN:STANDARD
DTSTART:16011028T040000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZOFFSETFROM:+0300
TZOFFSETTO:+0200
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010325T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZOFFSETFROM:+0200
TZOFFSETTO:+0300
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Customized Time Zone:20270204T090000
BEGIN:VALARM
TRIGGER:-PT1H
...

Outlook/Exchange sends exactly this, so it's common in practice. Master only gets it right because the calendar's timezone usually matches the user's own zone, but the PR would break it for everyone. The approach suggested above handles this too: keep the fallback and skip it only when the stored date is explicitly UTC (a Z suffix or a literal UTC/Etc/UTC TZID).

Sabre recurrence expansion can rewrite an unresolved TZID as UTC. Inspect the stored event date before exempting explicit UTC alarms from the calendar-timezone fallback, so Outlook and custom VTIMEZONE reminders retain their prior scheduling. Reuse the resolved timestamp for filtering and storage to keep expiry decisions consistent.

Assisted-by: Copilot:gpt-6.1-sol
Signed-off-by: Yezheng Li <yezhengli9@outlook.com>
@yezhengli-Mr9
yezhengli-Mr9 marked this pull request as draft December 2, 2026 00:04
@yezhengli-Mr9

Copy link
Copy Markdown
Author

Adding to the review above: unresolvable timezones aren't limited to Outlook's Windows names. They also include custom timezones that are valid under RFC 5545, i.e. a TZID defined by an embedded VTIMEZONE.

For example, this event in a Europe/Helsinki calendar is due at 06:00Z on master and at 08:00Z with this PR:

Thanks for the PR. One blocker: timezones that Sabre can't resolve (e.g. Outlook's FLE Standard Time, Europe/Kiev, Customized Time Zone) end up as UTC but aren't floating, so they no longer get the calendar timezone. A 09:00 FLE Standard Time event with -PT1H in a Europe/Helsinki calendar is due at 08:00Z instead of 06:00Z (correct on master). getEventObject() also rewrites the date, so please decide on the stored event: keep the UTC check and skip the conversion only if the stored date is explicitly UTC.

Adding to the review above: unresolvable timezones aren't limited to Outlook's Windows names. They also include custom timezones that are valid under RFC 5545, i.e. a TZID defined by an embedded VTIMEZONE.

For example, this event in a Europe/Helsinki calendar is due at 06:00Z on master and at 08:00Z with this PR:

Thanks, let me double check.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants