mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Bug Fix, can't create schedule on Sunday (#13876)
This commit is contained in:
parent
61d09072a7
commit
3959a7475c
@ -206,6 +206,7 @@ class HaScheduleForm extends LitElement {
|
|||||||
private get _events() {
|
private get _events() {
|
||||||
const events: any[] = [];
|
const events: any[] = [];
|
||||||
const currentDay = new Date().getDay();
|
const currentDay = new Date().getDay();
|
||||||
|
const baseDay = currentDay === 0 ? 7 : currentDay;
|
||||||
|
|
||||||
for (const [i, day] of weekdays.entries()) {
|
for (const [i, day] of weekdays.entries()) {
|
||||||
if (!this[`_${day}`].length) {
|
if (!this[`_${day}`].length) {
|
||||||
@ -214,7 +215,7 @@ class HaScheduleForm extends LitElement {
|
|||||||
|
|
||||||
this[`_${day}`].forEach((item: ScheduleDay, index: number) => {
|
this[`_${day}`].forEach((item: ScheduleDay, index: number) => {
|
||||||
// Add 7 to 0 because we start the calendar on Monday
|
// Add 7 to 0 because we start the calendar on Monday
|
||||||
const distance = i - currentDay + (i === 0 ? 7 : 0);
|
const distance = i - baseDay + (i === 0 ? 7 : 0);
|
||||||
|
|
||||||
const start = new Date();
|
const start = new Date();
|
||||||
start.setDate(start.getDate() + distance);
|
start.setDate(start.getDate() + distance);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user