diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index a3387f9483..c28e90f8f0 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -206,6 +206,7 @@ class HaScheduleForm extends LitElement { private get _events() { const events: any[] = []; const currentDay = new Date().getDay(); + const baseDay = currentDay === 0 ? 7 : currentDay; for (const [i, day] of weekdays.entries()) { if (!this[`_${day}`].length) { @@ -214,7 +215,7 @@ class HaScheduleForm extends LitElement { this[`_${day}`].forEach((item: ScheduleDay, index: number) => { // 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(); start.setDate(start.getDate() + distance);