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

Method _isDayInsideSelectionRange

packages/main/src/DayPicker.ts:487–500  ·  view source on GitHub ↗

* Tells if the day is inside a selection range (light blue). * @param timestamp * @private

(timestamp: number)

Source from the content-addressed store, hash-verified

485 * @private
486 */
487 _isDayInsideSelectionRange(timestamp: number): boolean {
488 // No selection at all (or not in range selection mode)
489 if (this.selectionMode !== CalendarSelectionMode.Range || !this.selectedDates.length) {
490 return false;
491 }
492
493 // Only one date selected - the user is hovering with the mouse or navigating with the keyboard to select the second one
494 if (this.selectedDates.length === 1 && this._secondTimestamp) {
495 return isBetween(timestamp, this.selectedDates[0], this._secondTimestamp);
496 }
497
498 // Two dates selected - stable range
499 return isBetween(timestamp, this.selectedDates[0], this.selectedDates[this.selectedDates.length - 1]);
500 }
501
502 /**
503 * Selects/deselects a day.

Callers 1

_buildWeeksMethod · 0.95

Calls 1

isBetweenFunction · 0.70

Tested by

no test coverage detected