Skip to content

Commit

Permalink
Fix missing range labels in date-range-picker (#18274)
Browse files Browse the repository at this point in the history
Co-authored-by: Bram Kragten <[email protected]>
  • Loading branch information
karwosts and bramkragten authored Oct 21, 2023
1 parent 96fbd8a commit d992b2d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/ha-date-range-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down

0 comments on commit d992b2d

Please sign in to comment.