diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index 2c238c1ef4..3eb7f700ae 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -208,7 +208,10 @@ class HaScheduleForm extends LitElement { private get _events() { const events: any[] = []; const currentDay = new Date().getDay(); - const baseDay = currentDay === 0 ? 7 : currentDay; + const baseDay = + currentDay === 0 && firstWeekdayIndex(this.hass.locale) === 1 + ? 7 + : currentDay; for (const [i, day] of weekdays.entries()) { if (!this[`_${day}`].length) { @@ -216,8 +219,11 @@ 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 - baseDay + (i === 0 ? 7 : 0); + // Add 7 to 0 because we start the calendar on Monday, except when the locale says otherwise (firstWeekdayIndex() != 1) + const distance = + i - + baseDay + + (i === 0 && firstWeekdayIndex(this.hass.locale) === 1 ? 7 : 0); const start = new Date(); start.setDate(start.getDate() + distance);