Custom available dates in calendar

Hi,
I would like to ask if there is currently possibility to select which dates are available. For example Min and Max specify the range of available dates, I would like to specify dates, because I want to be available to select dates with free capacity only.

Thanks for your answear
Lukas

1 Reply 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team May 18, 2021 07:34 AM UTC

Hi Lukas, 

Thanks for contacting Syncfusion support. 

Based on the information you have provided, we suspect you want to disable certain dates in the calendar so you can select only available dates. If that's the case, we recommend using the OnRenderDayCell event to disable specific days, as seen in the code snippet below. You can disable unique dates by comparing the date returned in the OnRenderDayCell argument. 

<SfCalendar TValue="DateTime?" @bind-Value="DateValue"> 
    <CalendarEvents TValue="DateTime?" OnRenderDayCell="onRenderDayCellHandler"></CalendarEvents> 
</SfCalendar> 
 
@code{ 
    public DateTime? DateValue { get; set; } 
    public void onRenderDayCellHandler(RenderDayCellEventArgs args) 
    { 
        if (args.Date.DayOfWeek.ToString() == "Monday" || args.Date.DayOfWeek.ToString() == "Friday") 
        { 
            args.IsDisabled = true; 
        } 
    } 
} 

 


Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon