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

Method _modifyDateValue

packages/main/src/DatePicker.ts:572–580  ·  view source on GitHub ↗

* @param amount * @param unit * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April) * @protected

(amount: number, unit: string, preserveDate?: boolean)

Source from the content-addressed store, hash-verified

570 * @protected
571 */
572 _modifyDateValue(amount: number, unit: string, preserveDate?: boolean) {
573 if (!this.dateValue) {
574 return;
575 }
576
577 const modifiedDate = modifyDateBy(CalendarDate.fromLocalJSDate(this.dateValue), amount, unit, preserveDate, this._minDate, this._maxDate);
578 const newValue = this.formatValue(modifiedDate.toUTCJSDate());
579 this._updateValueAndFireEvents(newValue, true, ["change", "value-changed"]);
580 }
581
582 _updateValueAndFireEvents(value: string, normalizeValue: boolean, events: Array<"change" | "value-changed" | "input">, updateValue: boolean = true) {
583 const valid = this._checkValueValidity(value);

Callers 1

_onkeydownMethod · 0.95

Calls 5

formatValueMethod · 0.95
modifyDateByFunction · 0.85
fromLocalJSDateMethod · 0.80
toUTCJSDateMethod · 0.80

Tested by

no test coverage detected