Fix week period selectors (#6303)

This commit is contained in:
Bram Kragten 2020-07-02 17:38:03 +02:00 committed by GitHub
parent 19e32752bb
commit 750e7b1262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ class HaPanelHistory extends LitElement {
todayCopy.setDate(today.getDate() - today.getDay()) todayCopy.setDate(today.getDate() - today.getDay())
); );
const thisWeekEnd = new Date( const thisWeekEnd = new Date(
todayCopy.setDate(today.getDate() - today.getDay() + 7) todayCopy.setDate(thisWeekStart.getDate() + 7)
); );
thisWeekEnd.setMilliseconds(thisWeekEnd.getMilliseconds() - 1); thisWeekEnd.setMilliseconds(thisWeekEnd.getMilliseconds() - 1);
@ -119,7 +119,7 @@ class HaPanelHistory extends LitElement {
todayCopy.setDate(today.getDate() - today.getDay() - 7) todayCopy.setDate(today.getDate() - today.getDay() - 7)
); );
const lastWeekEnd = new Date( const lastWeekEnd = new Date(
todayCopy.setDate(today.getDate() - today.getDay()) todayCopy.setDate(lastWeekStart.getDate() + 7)
); );
lastWeekEnd.setMilliseconds(lastWeekEnd.getMilliseconds() - 1); lastWeekEnd.setMilliseconds(lastWeekEnd.getMilliseconds() - 1);

View File

@ -149,7 +149,7 @@ export class HaPanelLogbook extends LitElement {
todayCopy.setDate(today.getDate() - today.getDay()) todayCopy.setDate(today.getDate() - today.getDay())
); );
const thisWeekEnd = new Date( const thisWeekEnd = new Date(
todayCopy.setDate(today.getDate() - today.getDay() + 7) todayCopy.setDate(thisWeekStart.getDate() + 7)
); );
thisWeekEnd.setMilliseconds(thisWeekEnd.getMilliseconds() - 1); thisWeekEnd.setMilliseconds(thisWeekEnd.getMilliseconds() - 1);
@ -157,7 +157,7 @@ export class HaPanelLogbook extends LitElement {
todayCopy.setDate(today.getDate() - today.getDay() - 7) todayCopy.setDate(today.getDate() - today.getDay() - 7)
); );
const lastWeekEnd = new Date( const lastWeekEnd = new Date(
todayCopy.setDate(today.getDate() - today.getDay()) todayCopy.setDate(lastWeekStart.getDate() + 7)
); );
lastWeekEnd.setMilliseconds(lastWeekEnd.getMilliseconds() - 1); lastWeekEnd.setMilliseconds(lastWeekEnd.getMilliseconds() - 1);