From 39f98d430bf36fc8bca1c8d84509deef8e03541a Mon Sep 17 00:00:00 2001 From: boern99 Date: Fri, 3 Jan 2025 11:59:42 +0000 Subject: [PATCH] improved ZoomIn for today --- src/components/ha-date-range-picker.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/ha-date-range-picker.ts b/src/components/ha-date-range-picker.ts index ee2b1507123e..7c21c506e650 100644 --- a/src/components/ha-date-range-picker.ts +++ b/src/components/ha-date-range-picker.ts @@ -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),