Calendar flexibility in selecting specialDates/disabledDates
Question
The DateRangeDescriptor class provides means to configure dates selection in following ways:
- BETWEEN two dates
- AFTER a date
- BEFORE a date
- SPECIFIC dates
- All WEEKENDS
- All WEEKDAYS
Why not being able to specify the following as well:
- All weekends BETWEEN two dates
- All weekdays BEETWEEN two dates
The above seems to require no API changes and only implementation changes to respect the range provided:
this.calendar.disabledDates = [
{ type: DateRangeType.Weekends, dateRange: range },
];
this.calendar.specialDates= [
{ type: DateRangeType.Weekdays, dateRange: range },
];
- All weekends/weekdays AFTER a date
- All weekends/weekdays BEFORE a date
Those two seem to require API changes, maybe passing a second type constraint:
this.calendar.specialDates= [
{ type: DateRangeType.Weekdays, dateRange: singleDate, secondConstraint: DateRangeType.After },
];
but seems to bring complexity that is not worth to handle I think.
So are you suggesting we introduce new enumeration for all the cases you've listed? In total that would be 6 new entries. Another approach would be to introduce a second parameter to the WEEKENDS and WEEKDAYS members to specify the constraint.
Another approach would be to introduce a second parameter to the WEEKENDS and WEEKDAYS members to specify the constraint.
That's what I though too. The second constraint can be passed even now and is ignored, if type is WEEKENDS or WEEKDAYS.
It seems a dev continue to do what is doing now:
this.calendar.disabledDates = [
{ type: DateRangeType.Weekends, dateRange: range },
];
this.calendar.specialDates= [
{ type: DateRangeType.Weekdays, dateRange: range },
];
and no changes in the API are needed, just implementation changes.
Extending the enum would be cleaner in terms of usage in the component after. Second parameter would mean passing another DateRangeDescriptor inside, but then using only BEFORE, AFTER and BETWEEN from it. We can't disallow passing the rest. You will have then cases inside the WEEKEND and WEEKDAY cases, which will bloat the code IMO.
Extending the enum would be cleaner in terms of usage in the component after
That would mean to add two new enums to the already available, to serve for the last cases suggested - weekends/weekdays AFTER/BEFORE a date, right?
There has been no recent activity and this issue has been marked inactive.
@hanastasov This never reached development, or did we not associate it with the issue?
Never reached development, that's why there is also no PR associated.