Closed phazlett closed 4 years ago
Hi, yes it's possible. For example by using DaysEnabledFunction
propery:
@page "/startDate"
<DateRangePicker @ref="Picker"
DaysEnabledFunction="IsDayEnabled"
@bind-StartDate="StartDate"
@bind-EndDate="EndDate">
</DateRangePicker>
@code {
DateRangePicker Picker;
DateTimeOffset? StartDate { get; set; } = DateTime.Now;
DateTimeOffset? EndDate { get; set; }
private bool IsDayEnabled(DateTimeOffset day)
{
return (Picker?.TStartDate, Picker?.TEndDate) switch
{
(null, null) => day.Date == DateTime.Today,
(_, null) => day.Date >= DateTime.Today,
(_, _) => day.Date == DateTime.Today,
};
}
}
Is there a way to make the start date read-only while allowing the end date to be modified?