Search results

Date Range

A calendar provides an option to select a date value within a specified range by defining the Min and Max properties. The Min date should always be lesser than the Max date.

If the value of Min or Max properties are changed through code behind, then update the Value property to be set within the specified range.

If the value is out of specified date range and less than Min date, the Value property will be updated with Min date or the value is higher than Max date, the Value property will be updated with Max date.

The following code allows you to select a date within the range of 7th to 27th days in a month.

@using Syncfusion.EJ2.Blazor.Calendars

<EjsCalendar Min='@MinDate' Max='@MaxDate' Value='@DateValue'></EjsCalendar>

@code{
    public DateTime MinDate {get;set;} = new DateTime(DateTime.Now.Year,DateTime.Now.Month,07);
    public DateTime MaxDate {get;set;} = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 27);
    public DateTime DateValue {get;set;} = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 14);
}

The output will be as follows.

calendar