MCPcopy Create free account
hub / github.com/UI5/webcomponents / _isDateEnabled

Method _isDateEnabled

packages/main/src/DayPicker.ts:875–897  ·  view source on GitHub ↗

* Checks if a given date is enabled (selectable). * A date is considered disabled if: * - It falls outside the min/max date range defined by the component * - It matches a single disabled date * - It falls within a disabled date range (exclusive of start and end dates) * @param date - The

(date: CalendarDate, minDate?: CalendarDate, maxDate?: CalendarDate, precomputedDisabledDates?: Array<{ startTimestamp: number, endTimestamp: number }>)

Source from the content-addressed store, hash-verified

873 * @private
874 */
875 _isDateEnabled(date: CalendarDate, minDate?: CalendarDate, maxDate?: CalendarDate, precomputedDisabledDates?: Array<{ startTimestamp: number, endTimestamp: number }>): boolean {
876 const resolvedMin = minDate ?? this._minDate;
877 const resolvedMax = maxDate ?? this._maxDate;
878
879 if ((resolvedMin && date.isBefore(resolvedMin))
880 || (resolvedMax && date.isAfter(resolvedMax))) {
881 return false;
882 }
883
884 const dateTimestamp = date.valueOf() / 1000;
885 const disabledRanges = precomputedDisabledDates ?? this.disabledDates.map(range => ({
886 startTimestamp: this._getTimestampFromDateValue(range.startValue),
887 endTimestamp: this._getTimestampFromDateValue(range.endValue),
888 }));
889
890 return !disabledRanges.some(({ startTimestamp, endTimestamp }) => {
891 if (endTimestamp) {
892 return dateTimestamp > startTimestamp && dateTimestamp < endTimestamp;
893 }
894
895 return startTimestamp && dateTimestamp === startTimestamp;
896 });
897 }
898
899 /**
900 * Converts a date value string to a timestamp.

Callers 1

_buildWeeksMethod · 0.95

Calls 4

isBeforeMethod · 0.80
isAfterMethod · 0.80
valueOfMethod · 0.80

Tested by

no test coverage detected