Fix end-time reminder firing at event start instead of end (ical.net Period.EndTime null bug)#17
Merged
wen-templari merged 2 commits intomainfrom Mar 27, 2026
Conversation
…nt when Period.EndTime is null (ical.net 5.1.1 bug) Agent-Logs-Url: https://github.com/nbtca/HuaJiBot.NET/sessions/98314277-209b-4b98-8be4-d16c908c5ad5 Co-authored-by: wen-templari <52404670+wen-templari@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix parsing issue with schedule reminder end time
Fix end-time reminder firing at event start instead of end (ical.net Period.EndTime null bug)
Mar 27, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
occurrence.Period.EndTimeis alwaysnullin ical.net 5.1.1 when using the single-argumentGetOccurrences(startArg)overload. ThePeriodwrapper silently fell back toStartTime, so end reminders were scheduled 5 min before the event start rather than its end — and the displayed end time was wrong.Confirmed against the live calendar: for NWDC(BaaS)with
DTSTART=20:30 DTEND=22:30, the end reminder fired at 20:25 instead of 22:25.Changes
CalendarExtensions.cs—Period.EndTime: Replace thep.EndTime ?? p.StartTimefallback with aComputeEndTime()helper that derives end time asoccurrence.Start + (ev.End − ev.Start). Using duration rather thanev.Enddirectly is required for recurring events —ev.Endcarries the base occurrence's date and would be wrong for all future recurrences.CalendarExtensions.cs—GetEvents(): PasscalendarEventto thePeriodconstructor so it has access to the event duration.ReminderTask.cs: End reminder message and log now displayeventEndTime(the per-occurrence computed value) instead ofev.End?.ToLocalNetworkTime(). Also fixes the log text "分钟后开始日程" → "分钟后结束日程".💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.