Skip to content

Commit

Permalink
Fix undefined values in the attributes #1189
Browse files Browse the repository at this point in the history
  • Loading branch information
andriivarhanov committed Apr 25, 2023
1 parent c3e7863 commit 066ba4b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/ids-time-picker/ids-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ export default class IdsTimePicker extends Base {
*/
#parseInputValue(): void {
const value = this.input?.value || this.value;
if (!value) return;
const inputDate = this.localeAPI?.parseDate(
value,
{ dateFormat: this.format }
Expand All @@ -371,19 +370,19 @@ export default class IdsTimePicker extends Base {
const period = inputDate && this.localeAPI?.calendar()?.dayPeriods[hours24 >= 12 ? 1 : 0];

if (this.#is24Hours() && hours24 !== this.hours) {
this.hours = hours24;
this.hours = hours24 >= 0 ? hours24 : null;
}

if (this.#is12Hours() && hours12 !== this.hours) {
this.hours = hours12;
this.hours = hours12 >= 0 ? hours12 : null;
}

if (minutes !== this.minutes) {
this.minutes = minutes;
this.minutes = minutes >= 0 ? minutes : null;
}

if (seconds !== this.seconds) {
this.seconds = seconds;
this.seconds = seconds >= 0 ? seconds : null;
}

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

0 comments on commit 066ba4b

Please sign in to comment.