Skip to content

Commit

Permalink
Add locale change listener to time picker #1189
Browse files Browse the repository at this point in the history
  • Loading branch information
andriivarhanov committed Mar 31, 2023
1 parent 310ffcd commit ec7dd1e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/components/ids-time-picker/ids-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,26 @@ export default class IdsTimePicker extends Base {
return this;
}

/** Translate Labels on Language Change */
onLanguageChange = () => {
if (!this.hasAttribute(attributes.FORMAT)) {
this.setAttribute(attributes.FORMAT, this.localeAPI?.calendar().timeFormat);
/**
* Respond to changing locale
*/
onLocaleChange = () => {
if (this.picker) {
this.picker.format = this.format;
this.picker.locale = this.locale;
}
if (this.input) {
this.input.format = this.format;
this.input.locale = this.locale;
}
this.picker?.renderDropdowns();
this.#setTimeValidation();
};

/**
* Respond to changing language
*/
onLanguageChange = () => {
this.picker?.renderDropdowns();
};

/**
Expand Down

0 comments on commit ec7dd1e

Please sign in to comment.