From bed470f79d3b42a2094763eff9a50d583658bcce Mon Sep 17 00:00:00 2001 From: boern99 <36338790+boern99@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:57:08 +0100 Subject: [PATCH] add previous and next button to History and Logbook (#22802) * add previous and next button to History and Logbook * used date-fns and changed media-query-resolution to fit on mobiles * hide .prev and .next on small screens; optimized dateRange for ranges lower 1 day * fixed Date type number --- src/components/ha-date-range-picker.ts | 63 +++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/src/components/ha-date-range-picker.ts b/src/components/ha-date-range-picker.ts index 4e541e0a7e..3b9695310c 100644 --- a/src/components/ha-date-range-picker.ts +++ b/src/components/ha-date-range-picker.ts @@ -15,6 +15,10 @@ import { startOfMonth, startOfWeek, startOfYear, + differenceInMilliseconds, + addMilliseconds, + subMilliseconds, + roundToNearestHours, } from "date-fns"; import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import { LitElement, css, html, nothing } from "lit"; @@ -30,6 +34,8 @@ import "./date-range-picker"; import "./ha-icon-button"; import "./ha-svg-icon"; import "./ha-textfield"; +import "./ha-icon-button-next"; +import "./ha-icon-button-prev"; export interface DateRangePickerRanges { [key: string]: [Date, Date]; @@ -249,6 +255,12 @@ export class HaDateRangePicker extends LitElement {