diff --git a/Client/Pages/Index.razor.cs b/Client/Pages/Index.razor.cs index da3764c..81bf0a7 100644 --- a/Client/Pages/Index.razor.cs +++ b/Client/Pages/Index.razor.cs @@ -331,15 +331,15 @@ namespace ShiftScheduler.Client.Pages foreach (var day in days) { - // Add the day to current week - currentWeek.Add(day); - - // End the week when it's Sunday - if (day.DayOfWeek == DayOfWeek.Sunday) + // Start a new week if this is Monday and we have days in current week + if (day.DayOfWeek == DayOfWeek.Monday && currentWeek.Count > 0) { weeks.Add(currentWeek); currentWeek = new List(); } + + // Add the day to current week + currentWeek.Add(day); } // Add any remaining days as the last week