diff --git a/src/Plugin.Maui.Calendar/Shared/Controls/ViewLayoutEngines/MultiSelectionEngine.cs b/src/Plugin.Maui.Calendar/Shared/Controls/ViewLayoutEngines/MultiSelectionEngine.cs index 3cd7d18..d80a07a 100644 --- a/src/Plugin.Maui.Calendar/Shared/Controls/ViewLayoutEngines/MultiSelectionEngine.cs +++ b/src/Plugin.Maui.Calendar/Shared/Controls/ViewLayoutEngines/MultiSelectionEngine.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Globalization; using Plugin.Maui.Calendar.Controls.Interfaces; using Plugin.Maui.Calendar.Models; @@ -16,9 +16,16 @@ public MultiSelectionEngine() public string GetSelectedDateText(string selectedDateTextFormat, CultureInfo culture) { - return _selectedDates - .Select(item => item.ToString(selectedDateTextFormat, culture)) - .Aggregate((a, b) => $"{a}, {b}"); + string dates = ""; + if (_selectedDates?.Any(item => item > DateTime.MinValue) == true) + { + dates = _selectedDates + .Where(item => item > DateTime.MinValue) + .Select(item => item.ToString(selectedDateTextFormat, culture)) + .Aggregate((a, b) => $"{a}, {b}"); + } + + return dates ?? string.Empty; } public bool TryGetSelectedEvents(EventCollection allEvents, out ICollection selectedEvents)