From 1d236bfa810d64743ccc76aa2bfbf1ebedcb4396 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 2 Dec 2026 03:14:49 +0400 Subject: [PATCH] refac --- .../automations/AutomationEditor.svelte | 4 +++ .../automations/ScheduleTrigger.svelte | 29 +++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/lib/components/automations/AutomationEditor.svelte b/src/lib/components/automations/AutomationEditor.svelte index 7e2c913ec2..55e681ed16 100644 --- a/src/lib/components/automations/AutomationEditor.svelte +++ b/src/lib/components/automations/AutomationEditor.svelte @@ -847,6 +847,7 @@ scheduleTick++} /> {/if} @@ -967,6 +968,9 @@ +
+ {action_type === 'code' ? $i18n.t('Code') : $i18n.t('Prompt')} +
{#if action_type === 'code'}
day.key); $: activeDays = selectedDays.length ? selectedDays : defaultDays; $: daysLabel = @@ -114,10 +118,8 @@ } parts.push(`BYMINUTE=${minute}`); // Hourly repeats count from midnight of the start date. - const start = startDate - ? `DTSTART:${startDate.replace(/-/g, '')}T${freq === 'HOURLY' ? '00' : pad(hour)}${pad(minute)}00\n` - : ''; - return `${start}RRULE:${parts.join(';')}`; + const start = `${startDate.replace(/-/g, '')}T${freq === 'HOURLY' ? '00' : pad(hour)}${pad(minute)}00`; + return `${startFromFallback ? '' : `DTSTART:${start}\n`}RRULE:${parts.join(';')}`; }; export const buildRrule = (): string => (frequency === 'CUSTOM' ? customRrule : build(frequency)); @@ -164,7 +166,10 @@ minute = parseInt(parts.BYMINUTE || match?.[5] || '0'); selectedDays = parts.BYDAY ? parts.BYDAY.split(',') : []; monthDay = parseInt(parts.BYMONTHDAY || '1'); - startDate = match ? `${match[1]}-${match[2]}-${match[3]}` : ''; + startFromFallback = !match; + startDate = match + ? `${match[1]}-${match[2]}-${match[3]}` + : fallbackStart || dayjs().format('YYYY-MM-DD'); }; // Bare values inside the editor's label | value rows. @@ -206,9 +211,15 @@ { + if (!e.currentTarget.value) return; + startDate = e.currentTarget.value; + startFromFallback = false; + onChange(); + }} /> {$i18n.t('every')}