Skip to content

Commit

Permalink
Merge pull request #3 from jasonnator/fix-MultiSelectionEngine
Browse files Browse the repository at this point in the history
fix MultiSelectionEngine
  • Loading branch information
yurkinh authored Nov 26, 2023
2 parents fa8687f + 832d7f9 commit 44397d5
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Globalization;
using Plugin.Maui.Calendar.Controls.Interfaces;
using Plugin.Maui.Calendar.Models;
Expand All @@ -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)
Expand Down

0 comments on commit 44397d5

Please sign in to comment.