Currently, when dates need to be disable in the DatePicker and DateRangePicker, a collection of induvial dates are provided. As a result, when I need to disable a 90 day or 180 day continuous range I need to add to the collection 90 or 180 day individual DateTime objects.
It would be more efficient to provide a range of dates to disable instead of induvial dates.
The DisabledDates should accept a collection of DisableDateItems that is similar to the below:
public class DisableDateItem
{
public DateTime RangeBegin { get; set; }
public DateTime RangeEnd { get; set; }
}
Using this collection I can disable an individual date by having the RangeBegin and RangeEnd dates be the same, as shown below:
var bankHoliday = new DisableDateTime
{
RangeBegin = new DateTime(2021, 09, 01),
RangeEnd = new DateTime(2021, 09, 01)
};
To disable a date range, for example the Eastern Good Friday Weekend, I would provide a DisableDateTime as:
var bankHoliday = new DisableDateTime
{
RangeBegin = new DateTime(2021, 04, 30),
RangeEnd = new DateTime(2021, 05, 02)
};
To disable a 90 day range, I would provide a DisableDateTime object as:
var bankHoliday = new DisableDateTime { RangeBegin = new DateTime(2021, 05, 01), RangeEnd = new DateTime(2021, 07, 30) };