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

Method _isRelativeValue

packages/main/src/DateRangePicker.ts:168–181  ·  view source on GitHub ↗

* Checks if a date string is a relative date (e.g. "today", "tomorrow") * that would be resolved by DateFormat.parseRelative(). * Relative dates are not supported in DateRangePicker. * @private

(dateString: string, format: DateFormat)

Source from the content-addressed store, hash-verified

166 * @private
167 */
168 _isRelativeValue(dateString: string, format: DateFormat): boolean {
169 const trimmed = dateString.trim();
170 if (!trimmed) {
171 return false;
172 }
173
174 const parsed = format.parse(trimmed);
175 if (!parsed) {
176 return false;
177 }
178
179 const formatted = format.format(parsed);
180 return formatted !== trimmed;
181 }
182
183 /**
184 * **Note:** The getter method is inherited and not supported. If called it will return an empty value.

Callers 3

isValidMethod · 0.95
isValidValueMethod · 0.95
isValidDisplayValueMethod · 0.95

Calls 2

parseMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected