From d992b2d40b77c42202687a99f93aef262dc9f979 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Sat, 21 Oct 2023 08:40:38 -0700 Subject: [PATCH] Fix missing range labels in date-range-picker (#18274) Co-authored-by: Bram Kragten --- src/components/ha-date-range-picker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/ha-date-range-picker.ts b/src/components/ha-date-range-picker.ts index 8bfe2cdd7d..7e63a1ddbc 100644 --- a/src/components/ha-date-range-picker.ts +++ b/src/components/ha-date-range-picker.ts @@ -60,7 +60,7 @@ export class HaDateRangePicker extends LitElement { @property() private _openingDirection = "right"; - protected willUpdate() { + protected willUpdate(changedProps: PropertyValues) { // set dialog opening direction based on position const datePickerPosition = this.getBoundingClientRect().x; if (datePickerPosition > (2 * window.innerWidth) / 3) { @@ -71,7 +71,11 @@ export class HaDateRangePicker extends LitElement { this._openingDirection = "center"; } - if (!this.hasUpdated && this.ranges === undefined) { + if ( + (!this.hasUpdated && this.ranges === undefined) || + (changedProps.has("hass") && + this.hass?.localize !== changedProps.get("hass")?.localize) + ) { const today = new Date(); const weekStartsOn = firstWeekdayIndex(this.hass.locale); const weekStart = calcDate(