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

Method _selectDate

packages/main/src/DayPicker.ts:509–532  ·  view source on GitHub ↗

* Selects/deselects a day. * @param e * @param isShift true if the user did Click+Shift or Enter+Shift (but not Space+Shift) * @param setTimestamp whether to move focus (timestamp) to the selected day; false for mouse clicks where focus is independent * @private

(e: Event, isShift: boolean, setTimestamp = true)

Source from the content-addressed store, hash-verified

507 * @private
508 */
509 _selectDate(e: Event, isShift: boolean, setTimestamp = true) {
510 let target = e.target as HTMLElement;
511
512 if (!target.hasAttribute("data-sap-timestamp")) {
513 target = target.parentNode as HTMLElement;
514 }
515
516 if (!this._isDayPressed(target)) {
517 return;
518 }
519
520 const timestamp = this._getTimestampFromDom(target);
521
522 if (setTimestamp) {
523 this._safelySetTimestamp(timestamp);
524 }
525 this._updateSecondTimestamp();
526 this._updateSelectedDates(timestamp, isShift);
527
528 this.fireDecoratorEvent("change", {
529 timestamp: this.timestamp,
530 dates: this.selectedDates,
531 });
532 }
533
534 _updateSelectedDates(timestamp: number, isShift: boolean) {
535 if (this.selectionMode === CalendarSelectionMode.Multiple) {

Callers 3

_onkeydownMethod · 0.95
_onkeyupMethod · 0.95
_onclickMethod · 0.95

Calls 6

_isDayPressedMethod · 0.95
_updateSelectedDatesMethod · 0.95
hasAttributeMethod · 0.80
_getTimestampFromDomMethod · 0.80
_safelySetTimestampMethod · 0.80

Tested by

no test coverage detected