Skip to main content
Version: 1.x

Function: setAndValidateDate()

setAndValidateDate(page, controlId, date, options?): Promise<void>

Defined in: src/modules/date.ts:480

Ai

Sets a date and validates that the control does not enter an error state.

Parameters

page

DatePage

Playwright Page (or compatible subset).

controlId

string

The ID of the DatePicker control.

date

DateInput

The date to set.

options?

DateOptions

Optional date operation settings.

Returns

Promise<void>

Intent

Set a date and verify the control does not show a validation error.

Guarantee

On success, the date is set and the control's valueState is not 'Error'.

Ai Context

Combines setDatePickerValue() with a valueState check. Throws if the date is outside the allowed range (minDate/maxDate) or format is invalid.

Sap Module

sap.m.DatePicker — setValue(), getValueState()

Business Context

Safely set dates with validation in SAP forms (e.g., fiscal period constraints).

Throws

ControlError if the control enters an error value state after setting.

Example

await setAndValidateDate(page, 'datePicker1', '2024-01-15');