Plugin.Maui.Calendar icon indicating copy to clipboard operation
Plugin.Maui.Calendar copied to clipboard

Clicking the current 'SelectedDate' on the calendar returns null.

Open Agistaris opened this issue 1 year ago • 3 comments

To replicate, simply click the same date twice on the calendar and it will return 'null'. I believe the behavior should be to return the date regardless of it being the current 'SelectedDate'. Just trying to report as much as I can. This is the best Calendar I have found thus far. Whatever I can do to help, let me know!

I'm using this work around for now for my purposes (simplified my code for this example) to maintain the Selected Date Background color:

private DateTime? _calendarDate = DateTime.Now.Date;
public DateTime? CalendarDate
{
    get => _calendarDate;
    set
    {
        _calendarDate = value;
        OnPropertyChanged(nameof(CalendarDate));
        SelectedMonth = CalendarDate?.ToString("MMMM, yyyy");
    }
}

private string _selectedMonth = "";
public string SelectedMonth
{
    get => _selectedMonth;
    set
    {
        _selectedMonth = value;
        OnPropertyChanged(nameof(SelectedMonth));
    }
}

private void CalendarDayTapped()
{
    var tempSelectedDate = Cal.SelectedDate;

    if (tempSelectedDate == null)
    {
        Cal.SelectedDate = CalendarDate;
    }
    else
    {
        CalendarDate = tempSelectedDate;
    }

    HideCalendar(null, null);

}

Agistaris avatar Jan 15 '24 14:01 Agistaris