From 615ce0ccf109c13bcb1941c59a641b525f9ecb5e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 30 Nov 2026 20:35:13 +0100 Subject: [PATCH] fix: an empty Custom schedule is saved as no schedule instead of being refused (#35387) When the schedule was set to Custom and the rule left empty, Create and Save stored the automation with no schedule and without any error, so it never ran on its own. They now refuse it with "Invalid value: Custom schedule" and save nothing. The Create dialog also refuses a Once schedule set in the past again. Fixes #35386 --- src/lib/components/AutomationModal.svelte | 18 ++++++++++++++---- .../automations/AutomationEditor.svelte | 5 +++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lib/components/AutomationModal.svelte b/src/lib/components/AutomationModal.svelte index cb450badab..7858a09d62 100644 --- a/src/lib/components/AutomationModal.svelte +++ b/src/lib/components/AutomationModal.svelte @@ -106,6 +106,9 @@ // Schedule dropdown ref let scheduleDropdown: ScheduleDropdown; + let scheduleFrequency: string; + let scheduleOnceDate: string; + let scheduleOnceTime: string; let savedRrule = ''; $: allowWebhook = !!$config?.features?.enable_automation_webhooks; @@ -118,12 +121,12 @@ toast.error($i18n.t('Channel is required')); return; } - if (scheduleDropdown.frequency === 'CUSTOM' && !scheduleDropdown.buildRrule().trim()) { + if (scheduleFrequency === 'CUSTOM' && !scheduleDropdown.buildRrule().trim()) { toast.error($i18n.t('Invalid value') + ': ' + $i18n.t('Custom schedule')); return; } - if (scheduleDropdown?.frequency === 'ONCE') { - const scheduled = new Date(`${scheduleDropdown.onceDate}T${scheduleDropdown.onceTime}`); + if (scheduleFrequency === 'ONCE') { + const scheduled = new Date(`${scheduleOnceDate}T${scheduleOnceTime}`); if (scheduled <= new Date()) { toast.error($i18n.t('Scheduled time must be in the future')); return; @@ -335,7 +338,14 @@ class="flex flex-col sm:flex-row sm:items-center sm:justify-between px-4 pb-3.5 pt-1 gap-2" >
- + {#if allowWebhook || webhookEnabled} row.dropdown?.buildRrule() ?? ''); - if (scheduleRows.some((row, i) => row.dropdown?.frequency === 'CUSTOM' && !rrules[i].trim())) { + if (scheduleRows.some((row, i) => row.frequency === 'CUSTOM' && !rrules[i].trim())) { toast.error($i18n.t('Invalid value') + ': ' + $i18n.t('Custom schedule')); return; } @@ -745,6 +745,7 @@