Skip to content

Commit

Permalink
fix(ui5-(date)-time-picker): support relative values
Browse files Browse the repository at this point in the history
  • Loading branch information
hinzzx committed Jul 12, 2023
1 parent 001b6f9 commit dd1c3f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/main/src/TimePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ class TimePicker extends TimePickerBase {
@property()
formatPattern!: string;

onBeforeRendering() {
this.value = this.normalizeValue(this.value!) || this.value;
}

get _formatPattern() {
const hasHours = !!this.formatPattern.match(/H/i);
const fallback = !this.formatPattern || !hasHours;
Expand Down
3 changes: 3 additions & 0 deletions packages/main/test/pages/TimePicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<ui5-time-picker id="timepickerInput"></ui5-time-picker>
<ui5-input id="inputResult"></ui5-input>

<br /><br />
<ui5-title>Test "now" value</ui5-title>
<ui5-time-picker id="timepickerNow" value="now"></ui5-time-picker>

<br /><br />
<ui5-title>Test empty value</ui5-title>
Expand Down

0 comments on commit dd1c3f3

Please sign in to comment.