Skip to content

feat(ui5-time-picker): display-value and value-format properties are introduced#13071

Open
GDamyanov wants to merge 15 commits intomainfrom
timepicker-display-value-format
Open

feat(ui5-time-picker): display-value and value-format properties are introduced#13071
GDamyanov wants to merge 15 commits intomainfrom
timepicker-display-value-format

Conversation

@GDamyanov
Copy link
Contributor

@GDamyanov GDamyanov commented Feb 12, 2026

This PR introduces display-value and value-format properties to the ui5-time-picker component

Changes:

  • Added displayValue property for custom display formatting
  • Added valueFormat property for value parsing/formatting control
  • Updated TimePicker implementation to handle the new properties
  • Added sample demonstrating custom formatting

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Feb 12, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 12, 2026 12:41 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 13, 2026 07:38 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 13, 2026 07:57 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 13, 2026 08:29 Inactive
@GDamyanov GDamyanov requested a review from hinzzx February 16, 2026 12:24
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 17, 2026 08:02 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 18, 2026 08:04 Inactive
@GDamyanov GDamyanov requested a review from hinzzx February 18, 2026 15:00
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 18, 2026 15:06 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 23, 2026 08:02 Inactive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix documentation here as well, I did it in ui5-date-picker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

_isoFormatInstance?: DateFormat;
_displayFormatInstance?: DateFormat;
_valueFormatInstance?: DateFormat;
_lastDisplayFormatPattern?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

_displayFormatInstance?: DateFormat;
_valueFormatInstance?: DateFormat;
_lastDisplayFormatPattern?: string;
_lastValueFormatPattern?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

let parsedValue = this.getValueFormat().parse(this.value, true);
if (!parsedValue) {
// If it doesn't parse as valueFormat, try displayFormat
parsedValue = this.getDisplayFormat().parse(this.value, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the flow should be valueFormat->formatPattern->iso, the display format should not be a fallback format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1


// @ts-ignore oFormatOptions is a private API of DateFormat
return this.getFormat().oFormatOptions.pattern as string;
return this.getISOFormat().oFormatOptions.pattern as string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display default should be "medium", not ISO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

}

// Try to parse as valueFormat and display in displayFormat
const parsedValue = this.getValueFormat().parse(this.value, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should always have a display format, either set by the application or with formatpattern or with ISO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

Comment on lines 871 to 897
return this.getISOFormat();
}

const pattern = this._valueFormat;

// Return cached instance if pattern hasn't changed
if (this._valueFormatInstance && this._lastValueFormatPattern === pattern) {
return this._valueFormatInstance;
}

this._lastValueFormatPattern = pattern;

if (this._isValueFormatPattern) {
this._valueFormatInstance = DateFormat.getTimeInstance({
strictParsing: true,
pattern: this._valueFormat,
});
} else {
this._valueFormatInstance = DateFormat.getTimeInstance({
strictParsing: true,
style: this._valueFormat,
});
}

return this._valueFormatInstance;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should simplify this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

Comment on lines 845 to 866
const pattern = this._displayFormat;

// Return cached instance if pattern hasn't changed
if (this._displayFormatInstance && this._lastDisplayFormatPattern === pattern) {
return this._displayFormatInstance;
}

this._lastDisplayFormatPattern = pattern;

if (this._isDisplayFormatPattern) {
this._displayFormatInstance = DateFormat.getTimeInstance({
strictParsing: true,
pattern: this._displayFormat,
});
} else {
this._displayFormatInstance = DateFormat.getTimeInstance({
strictParsing: true,
style: this._displayFormat,
});
}

return this._displayFormatInstance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should simplify this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2a6d3c1

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 26, 2026 11:33 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 26, 2026 13:51 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants