Skip to content

Commit

Permalink
improved ZoomIn for today
Browse files Browse the repository at this point in the history
  • Loading branch information
boern99 committed Jan 3, 2025
1 parent 77df80d commit 39f98d4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/ha-date-range-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,20 @@ export class HaDateRangePicker extends LitElement {
this.hass.config
),
];
} else {
} else if (
diff / 2 > hoursToMilliseconds(1) &&
this.startDate < addHours(new Date(), 1)
) {
dateRange = [
calcDate(
this.startDate > new Date()
? subHours(new Date(), 1)
: addMilliseconds(this.startDate, diff / 3),
addMilliseconds(this.startDate, diff / 3),
roundToNearestHours,
this.hass.locale,
this.hass.config
),
calcDate(
this.endDate > new Date()
? new Date()
? addHours(new Date(), 1)
: diff < hoursToMilliseconds(1)
? addHours(this.startDate, 1)
: subMilliseconds(subMilliseconds(this.endDate, diff / 3), 1),
Expand Down

0 comments on commit 39f98d4

Please sign in to comment.