Skip to content

Commit

Permalink
Fix undefined values in hours/minutes/seconds/period attribute #1189
Browse files Browse the repository at this point in the history
  • Loading branch information
andriivarhanov committed Apr 3, 2023
1 parent ec7dd1e commit 5b3506c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/ids-time-picker/ids-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,10 @@ export default class IdsTimePicker extends Base {
* Parse input date and populate dropdowns
*/
#parseInputValue(): void {
const value = this.input?.value || this.value;
if (!value) return;
const inputDate = this.localeAPI?.parseDate(
this.input?.value || this.value,
value,
{ dateFormat: this.format }
) as Date;
const hours24 = inputDate?.getHours();
Expand All @@ -385,7 +387,7 @@ export default class IdsTimePicker extends Base {
this.seconds = seconds;
}

if (this.#hasPeriod()) {
if (this.#hasPeriod() && period !== this.period) {
this.period = period;
}
}
Expand Down

0 comments on commit 5b3506c

Please sign in to comment.