Skip to main content
Version: 1.x

Function: formatDateForUI5()

formatDateForUI5(date, format): string

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

Ai

Formats a Date object into a UI5-compatible date string.

Parameters

date

DateInput

The date to format (Date object or ISO string).

format

string

The target format pattern.

Returns

string

The formatted date string.

Intent

Convert a Date to a UI5 date format string for use with DatePicker controls.

Guarantee

Returns a correctly formatted date string matching the specified pattern.

Ai Context

Pure function (no browser context). Supports ISO, SAP_INTERNAL, EUROPEAN, US, JAPANESE formats. Use to prepare date values before passing to setDatePickerValue().

Sap Module

sap.m.DatePicker — valueFormat conversion

Business Context

Format dates for SAP UI5 date picker controls with locale-aware patterns.

Remarks

Pure function (no browser context). Supports the five patterns in DATE_FORMATS.

Throws

ControlError if the format is unsupported or the date is invalid.

Example

formatDateForUI5(new Date(2024, 0, 15), 'yyyy-MM-dd'); // '2024-01-15'
formatDateForUI5(new Date(2024, 0, 15), 'dd.MM.yyyy'); // '15.01.2024'