From 6e422135275ecef4b6936c260979bec4438607f1 Mon Sep 17 00:00:00 2001 From: Steven Cohn Date: Fri, 3 May 2024 12:34:04 -0400 Subject: [PATCH] limit calendar to no later than current month --- OneMoreCalendar/CalendarForm.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OneMoreCalendar/CalendarForm.cs b/OneMoreCalendar/CalendarForm.cs index 634149c6ba..859a5bbc22 100644 --- a/OneMoreCalendar/CalendarForm.cs +++ b/OneMoreCalendar/CalendarForm.cs @@ -111,6 +111,12 @@ private async Task SetMonth(int delta) : date.AddMonths(delta); } + if (date.StartOfMonth() > DateTime.Now.StartOfMonth()) + { + date = DateTime.Now.StartOfMonth(); + return; + } + var endDate = date.EndOfMonth(); var settings = new SettingsProvider();