Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include last 30 min and 2 hours into history page #23848

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
47 changes: 47 additions & 0 deletions src/components/ha-date-range-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@
import "@material/mwc-list/mwc-list-item";
import { mdiCalendar } from "@mdi/js";
import {
addHours,

Check failure on line 7 in src/components/ha-date-range-picker.ts

View workflow job for this annotation

GitHub Actions / Lint and check format

'addHours' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 7 in src/components/ha-date-range-picker.ts

View workflow job for this annotation

GitHub Actions / Lint and check format

'addHours' is defined but never used
addDays,
subMinutes,
subHours,
endOfMinute,
endOfHour,
endOfDay,
endOfMonth,
endOfWeek,
endOfYear,
startOfMinute,
startOfHour,
startOfDay,
startOfMonth,
startOfWeek,
Expand Down Expand Up @@ -102,6 +109,46 @@
);

this._ranges = {
[this.hass.localize("ui.components.date-range-picker.ranges.last_30_min")]: [
calcDate(
subMinutes(today, 30),
startOfMinute,
this.hass.locale,
this.hass.config,
{
weekStartsOn,
}
),
calcDate(
today,
endOfMinute,
this.hass.locale,
this.hass.config,
{
weekStartsOn,
}
)
],
[this.hass.localize("ui.components.date-range-picker.ranges.last_2_hours")]: [
calcDate(
subHours(today, 2),
startOfHour,
this.hass.locale,
this.hass.config,
{
weekStartsOn,
}
),
calcDate(
today,
endOfHour,
this.hass.locale,
this.hass.config,
{
weekStartsOn,
}
)
],
[this.hass.localize("ui.components.date-range-picker.ranges.today")]: [
calcDate(today, startOfDay, this.hass.locale, this.hass.config, {
weekStartsOn,
Expand Down
Loading