You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to select a range containing non-selectable date(s) (as determined by DaysEnabledFunction).
This should not be possible, or at least a setting should be available to turn off this possibility.
The text was updated successfully, but these errors were encountered:
Hi, there is no such setting, but the desired behavior is quite easy to achieve with this code:
<DateRangePicker@ref="Picker"MaxDate="MaxDate"DaysEnabledFunction="DaysEnabled"OnSelectionStart="OnSelectionStart"OnSelectionEnd="OnSelectionEnd" />
@code{DateRangePickerPicker{get; set; }DateTimeOffset?MaxDate{get; set; }boolDaysEnabled(DateTimeOffsetday)
{returnday.DayOfWeek!=DayOfWeek.Saturday&&day.DayOfWeek!=DayOfWeek.Sunday;
}voidOnSelectionStart(DateTimeOffsetstartDate)
{// Just for demonstration, use your own logicvarmaxDate=startDate;
for (inti=0; i<60; i++)
{if (!DaysEnabled(maxDate.AddDays(1))) break;
maxDate=maxDate.AddDays(1);
}MaxDate=maxDate;
}voidOnSelectionEnd(DateTimeOffsetendDate)
{MaxDate=null;
}}
There are also MaxSpan and MinSpan parameters, you can use them as well
It is possible to select a range containing non-selectable date(s) (as determined by DaysEnabledFunction).
This should not be possible, or at least a setting should be available to turn off this possibility.
The text was updated successfully, but these errors were encountered: